Mercurial > dotfiles
annotate .chezmoitemplates/config.vim @ 614:ad5e870cd4b2
replace osc52 plugin
author | zegervdv <zegervdv@me.com> |
---|---|
date | Mon, 25 Jul 2022 14:09:08 +0200 |
parents | 23426c0f0e58 |
children | f795168ece65 |
rev | line source |
---|---|
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
1 " vim:fdm=marker:ts=2:sw=2 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
2 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
3 let s:darwin = has('mac') |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
4 let s:windows = has('win32') |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
5 |
460 | 6 " Activate built in plugins |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
7 if !has('nvim') |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
8 if has('packages') |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
9 packadd! matchit |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
10 packadd! shellmenu |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
11 endif |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
12 endif |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
13 source $VIMRUNTIME/ftplugin/man.vim |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
14 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
15 if has("nvim") |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
16 let g:python3_host_prog=expand('$HOME/.config/virtualenvs/python3/bin/python') |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
17 let g:python_host_prog=expand('$HOME/.config/virtualenvs/python2/bin/python') |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
18 endif |
460 | 19 " |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
20 |
460 | 21 " General Settings and options |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
22 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
23 if !s:windows |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
24 if !isdirectory(expand(&backupdir)) |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
25 call mkdir(expand(&backupdir), "p") |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
26 endif |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
27 if !isdirectory(expand(&directory)) |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
28 call mkdir(expand(&directory), "p") |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
29 endif |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
30 end |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
31 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
32 if v:version >= 703 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
33 if !isdirectory(expand(&undodir)) |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
34 call mkdir(expand(&undodir), "p") |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
35 endif |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
36 endif |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
37 |
460 | 38 " |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
39 |
460 | 40 " Mappings |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
41 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
42 " Highlight VCS conflict markers |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
43 match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$' |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
44 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
45 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
46 " Search for selected text, forwards or backwards. |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
47 vnoremap <silent> * :<C-U> |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
48 \let old_reg=getreg('"')<Bar>let old_regtype=getregtype('"')<CR> |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
49 \gvy/<C-R><C-R>=substitute( |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
50 \escape(@", '/\.*$^~['), '\_s\+', '\\_s\\+', 'g')<CR><CR> |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
51 \gV:call setreg('"', old_reg, old_regtype)<CR> |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
52 vnoremap <silent> # :<C-U> |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
53 \let old_reg=getreg('"')<Bar>let old_regtype=getregtype('"')<CR> |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
54 \gvy?<C-R><C-R>=substitute( |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
55 \escape(@", '?\.*$^~['), '\_s\+', '\\_s\\+', 'g')<CR><CR> |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
56 \gV:call setreg('"', old_reg, old_regtype)<CR> |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
57 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
58 xnoremap <silent> p p:if v:register == '"'<Bar>let @@=@0<Bar>endif<CR> |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
59 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
60 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
61 if has('nvim') |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
62 tnoremap <C-h> <C-\><C-n><C-w>h |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
63 tnoremap <C-j> <C-\><C-n><C-w>j |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
64 tnoremap <C-k> <C-\><C-n><C-w>k |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
65 tnoremap <C-l> <C-\><C-n><C-w>l |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
66 augroup enter_term |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
67 au! |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
68 autocmd TermOpen * startinsert! |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
69 autocmd BufEnter * if &buftype ==# 'terminal' | :startinsert! | endif |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
70 autocmd BufLeave * if &buftype ==# 'terminal' | :stopinsert! | endif |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
71 augroup END |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
72 let $GIT_EDITOR = 'nvr -cc split --remote-wait' |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
73 endif |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
74 |
460 | 75 " |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
76 |
460 | 77 " Functions |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
78 " When editing a file, always jump to the last known cursor position. |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
79 " Don't do it for commit messages, when the position is invalid, or when |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
80 " inside an event handler (happens when dropping a file on gvim). |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
81 autocmd BufReadPost * |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
82 \ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") | |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
83 \ exe "normal g`\"" | |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
84 \ endif |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
85 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
86 |
460 | 87 " Detect Filetype from content if file has no extension |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
88 augroup newFileDetection |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
89 au! |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
90 autocmd CursorMovedI * call CheckFileType() |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
91 augroup END |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
92 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
93 function! CheckFileType() |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
94 if exists("b:countCheck") == 0 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
95 let b:countCheck = 0 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
96 endif |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
97 let b:countCheck += 1 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
98 if &filetype == "" && b:countCheck > 20 && b:countCheck < 200 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
99 filetype detect |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
100 " Delete the function if no filetype can be established, or the type has |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
101 " been found |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
102 elseif b:countCheck >= 200 || &filetype != "" |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
103 autocmd! newFileDetection |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
104 endif |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
105 endfunction |
460 | 106 " |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
107 |
460 | 108 " Make list-like commands more intuitive |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
109 " Copied from https://gist.github.com/romainl/047aca21e338df7ccf771f96858edb86 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
110 function! CCR() |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
111 let cmdline = getcmdline() |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
112 if cmdline =~ '\v\C^(ls|files|buffers)' |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
113 " like :ls but prompts for a buffer command |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
114 return "\<CR>:b" |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
115 elseif cmdline =~ '\v\C/(#|nu|num|numb|numbe|number)$' |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
116 " like :g//# but prompts for a command |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
117 return "\<CR>:" |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
118 elseif cmdline =~ '\v\C^(dli|il)' |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
119 " like :dlist or :ilist but prompts for a count for :djump or :ijump |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
120 return "\<CR>:" . cmdline[0] . "j " . split(cmdline, " ")[1] . "\<S-Left>\<Left>" |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
121 elseif cmdline =~ '\v\C^(cli|lli)' |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
122 " like :clist or :llist but prompts for an error/location number |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
123 return "\<CR>:sil " . repeat(cmdline[0], 2) . "\<Space>" |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
124 elseif cmdline =~ '\C^old' |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
125 " like :oldfiles but prompts for an old file to edit |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
126 set nomore |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
127 return "\<CR>:sil se more|e #<" |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
128 elseif cmdline =~ '\C^changes' |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
129 " like :changes but prompts for a change to jump to |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
130 set nomore |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
131 return "\<CR>:sil se more|norm! g;\<S-Left>" |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
132 elseif cmdline =~ '\C^ju' |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
133 " like :jumps but prompts for a position to jump to |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
134 set nomore |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
135 return "\<CR>:sil se more|norm! \<C-o>\<S-Left>" |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
136 elseif cmdline =~ '\C^marks' |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
137 " like :marks but prompts for a mark to jump to |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
138 return "\<CR>:norm! `" |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
139 elseif cmdline =~ '\C^undol' |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
140 " like :undolist but prompts for a change to undo |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
141 return "\<CR>:u " |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
142 else |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
143 return "\<CR>" |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
144 endif |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
145 endfunction |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
146 cnoremap <expr> <CR> CCR() |
460 | 147 " |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
148 |
460 | 149 " Text objects |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
150 function! s:inIndentation() |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
151 " select all text in current indentation level excluding any empty lines |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
152 " that precede or follow the current indentationt level; |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
153 " |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
154 " the current implementation is pretty fast, even for many lines since it |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
155 " uses "search()" with "\%v" to find the unindented levels |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
156 " |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
157 " NOTE: if the current level of indentation is 1 (ie in virtual column 1), |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
158 " then the entire buffer will be selected |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
159 " |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
160 " WARNING: python devs have been known to become addicted to this |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
161 " magic is needed for this |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
162 let l:magic = &magic |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
163 set magic |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
164 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
165 " move to beginning of line and get virtcol (current indentation level) |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
166 " BRAM: there is no searchpairvirtpos() ;) |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
167 normal! ^ |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
168 let l:vCol = virtcol(getline('.') =~# '^\s*$' ? '$' : '.') |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
169 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
170 " pattern matching anything except empty lines and lines with recorded |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
171 " indentation level |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
172 let l:pat = '^\(\s*\%'.l:vCol.'v\|^$\)\@!' |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
173 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
174 " find first match (backwards & don't wrap or move cursor) |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
175 let l:start = search(l:pat, 'bWn') + 1 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
176 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
177 " next, find first match (forwards & don't wrap or move cursor) |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
178 let l:end = search(l:pat, 'Wn') |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
179 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
180 if (l:end !=# 0) |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
181 " if search succeeded, it went too far, so subtract 1 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
182 let l:end -= 1 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
183 endif |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
184 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
185 " go to start (this includes empty lines) and--importantly--column 0 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
186 execute 'normal! '.l:start.'G0' |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
187 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
188 " skip empty lines (unless already on one .. need to be in column 0) |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
189 call search('^[^\n\r]', 'Wc') |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
190 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
191 " go to end (this includes empty lines) |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
192 execute 'normal! Vo'.l:end.'G' |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
193 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
194 " skip backwards to last selected non-empty line |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
195 call search('^[^\n\r]', 'bWc') |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
196 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
197 " go to end-of-line 'cause why not |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
198 normal! $o |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
199 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
200 " restore magic |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
201 let &magic = l:magic |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
202 endfunction |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
203 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
204 " "in indentation" (indentation level sans any surrounding empty lines) |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
205 xnoremap <silent> ii :<c-u>call <sid>inIndentation()<cr> |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
206 onoremap <silent> ii :<c-u>call <sid>inIndentation()<cr> |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
207 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
208 function! s:aroundIndentation() |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
209 " select all text in the current indentation level including any emtpy |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
210 " lines that precede or follow the current indentation level; |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
211 " |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
212 " the current implementation is pretty fast, even for many lines since it |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
213 " uses "search()" with "\%v" to find the unindented levels |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
214 " |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
215 " NOTE: if the current level of indentation is 1 (ie in virtual column 1), |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
216 " then the entire buffer will be selected |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
217 " |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
218 " WARNING: python devs have been known to become addicted to this |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
219 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
220 " magic is needed for this (/\v doesn't seem work) |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
221 let l:magic = &magic |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
222 set magic |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
223 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
224 " move to beginning of line and get virtcol (current indentation level) |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
225 " BRAM: there is no searchpairvirtpos() ;) |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
226 normal! ^ |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
227 let l:vCol = virtcol(getline('.') =~# '^\s*$' ? '$' : '.') |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
228 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
229 " pattern matching anything except empty lines and lines with recorded |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
230 " indentation level |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
231 let l:pat = '^\(\s*\%'.l:vCol.'v\|^$\)\@!' |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
232 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
233 " find first match (backwards & don't wrap or move cursor) |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
234 let l:start = search(l:pat, 'bWn') + 1 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
235 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
236 " NOTE: if l:start is 0, then search() failed; otherwise search() succeeded |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
237 " and l:start does not equal line('.') |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
238 " FORMER: l:start is 0; so, if we add 1 to l:start, then it will match |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
239 " everything from beginning of the buffer (if you don't like |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
240 " this, then you can modify the code) since this will be the |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
241 " equivalent of "norm! 1G" below |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
242 " LATTER: l:start is not 0 but is also not equal to line('.'); therefore, |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
243 " we want to add one to l:start since it will always match one |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
244 " line too high if search() succeeds |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
245 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
246 " next, find first match (forwards & don't wrap or move cursor) |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
247 let l:end = search(l:pat, 'Wn') |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
248 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
249 " NOTE: if l:end is 0, then search() failed; otherwise, if l:end is not |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
250 " equal to line('.'), then the search succeeded. |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
251 " FORMER: l:end is 0; we want this to match until the end-of-buffer if it |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
252 " fails to find a match for same reason as mentioned above; |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
253 " again, modify code if you do not like this); therefore, keep |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
254 " 0--see "NOTE:" below inside the if block comment |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
255 " LATTER: l:end is not 0, so the search() must have succeeded, which means |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
256 " that l:end will match a different line than line('.') |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
257 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
258 if (l:end !=# 0) |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
259 " if l:end is 0, then the search() failed; if we subtract 1, then it |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
260 " will effectively do "norm! -1G" which is definitely not what is |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
261 " desired for probably every circumstance; therefore, only subtract one |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
262 " if the search() succeeded since this means that it will match at least |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
263 " one line too far down |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
264 " NOTE: exec "norm! 0G" still goes to end-of-buffer just like "norm! G", |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
265 " so it's ok if l:end is kept as 0. As mentioned above, this means |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
266 " that it will match until end of buffer, but that is what I want |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
267 " anyway (change code if you don't want) |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
268 let l:end -= 1 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
269 endif |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
270 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
271 " finally, select from l:start to l:end |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
272 execute 'normal! '.l:start.'G0V'.l:end.'G$o' |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
273 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
274 " restore magic |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
275 let &magic = l:magic |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
276 endfunction |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
277 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
278 " "around indentation" (indentation level and any surrounding empty lines) |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
279 xnoremap <silent> ai :<c-u>call <sid>aroundIndentation()<cr> |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
280 onoremap <silent> ai :<c-u>call <sid>aroundIndentation()<cr> |
460 | 281 " |
282 " | |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
283 |
460 | 284 " Filetype specific settings |
285 " Text | |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
286 augroup ft_text |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
287 au! |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
288 " au BufNewFile,BufRead,BufEnter *.txt setlocal spell spelllang=en_gb |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
289 au BufNewFile,BufRead,BufEnter *.txt setlocal textwidth=0 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
290 augroup END |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
291 augroup ft_report |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
292 au! |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
293 au BufNewFile,BufRead,BufEnter *.rpt setlocal nowrap |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
294 au BufNewFile,BufRead,BufEnter *.rpt call ColorRpt() |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
295 au BufNewFile,BufRead,BufEnter *.log call ColorRpt() |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
296 augroup END |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
297 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
298 function! ColorRpt() |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
299 " Color numbers based on length |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
300 syn match String "\v<\d{1,3}>" |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
301 syn match Number "\v<\d{4,6}>" |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
302 syn match Statement "\v<\d{7,9}>" |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
303 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
304 " Color errors |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
305 syn match Error "\v^ERROR:.*$" |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
306 endfunction |
460 | 307 " |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
308 |
460 | 309 " Plugin settings |
310 " Gundo tree | |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
311 nnoremap <leader>u :GundoToggle<CR> |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
312 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
313 |
460 | 314 " |
315 " Vinegar/NetRW | |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
316 autocmd FileType netrw setl bufhidden=delete |
460 | 317 " |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
318 " Load local vimrc |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
319 if filereadable($HOME . '/.vimrc.local') |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
320 source ~/.vimrc.local |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
321 endif |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
322 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
323 " Load project local vimrc |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
324 if filereadable('.vimrc.local') |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
325 source .vimrc.local |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
326 endif |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
327 |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
328 augroup Chezmoi |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
329 autocmd! |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
330 autocmd BufWritePost ~/.local/share/chezmoi/* silent !chezmoi apply --source-path % |
472
d2b877b4ef8b
Automatically apply changes to templatefiles
zegervdv <zegervdv@me.com>
parents:
463
diff
changeset
|
331 autocmd BufWritePost ~/.local/share/chezmoi/.chezmoitemplates/init.lua silent !chezmoi apply --source-path ~/.local/share/chezmoi/dot_config/nvim/init.lua.tmpl |
d2b877b4ef8b
Automatically apply changes to templatefiles
zegervdv <zegervdv@me.com>
parents:
463
diff
changeset
|
332 autocmd BufWritePost ~/.local/share/chezmoi/.chezmoitemplates/config.vim silent !chezmoi apply --source-path ~/.local/share/chezmoi/dot_config/nvim/plugin/config.vim.tmpl |
451
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
333 autocmd BufWritePost ~/.local/share/chezmoi/dot_config/nvim/init.lua source <afile> | PackerCompile |
d99353d71702
Use common template for windows nvim config
zegervdv <zegervdv@me.com>
parents:
diff
changeset
|
334 augroup END |