~gpanders/dotfiles

ref: 2da1dde5ea566f82ebe6532bc6d3b8670fd77ce8 dotfiles/vim/.vim/after/plugin/projectionist/projectionist.vim -rw-r--r-- 1.1 KiB
2da1dde5Greg Anders Note 'open' subcommand opens editor in NOTES_DIR when no argument given 1 year, 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
" vim-projectionist configuration
" Author: Greg Anders <greg@gpanders.com>
" Date: 2019-12-09

if !get(g:, 'loaded_projectionist', 0)
  finish
endif

if !exists('g:projectionist_transformations')
  let g:projectionist_transformations = {}
endif

function! g:projectionist_transformations.date(input, o) abort
  return strftime('%Y-%m-%d')
endfunction

function! s:activate()
  " Binary (on/off) settings
  for opt in ['expandtab', 'readonly', 'modifiable', 'spell']
    for [root, value] in projectionist#query(opt)
      execute 'setlocal' (!value ? 'no' : '') . opt
    endfor
  endfor

  " Single value settings
  for opt in ['filetype', 'textwidth', 'shiftwidth', 'softtabstop', 'tabstop']
    for [root, value] in projectionist#query(opt)
      execute 'setlocal' opt . '=' . value
    endfor
  endfor

  " List settings
  for opt in ['suffixes', 'wildignore', 'tags']
    for [root, value] in projectionist#query(opt)
      if type(value) ==# type([])
        let value = join(value, ',')
      endif
      execute 'setlocal' opt . '^=' . value
    endfor
  endfor
endfunction

autocmd User ProjectionistActivate call s:activate()