... | ... |
@@ -6,11 +6,11 @@ |
6 | 6 |
|
7 | 7 |
" Comments are written in Vim's help |notation|, see |help-writing|, which can |
8 | 8 |
" be highlighted with |
9 |
-" https://git.rcrnstn.net/rcrnstn/vim-unobtrusive-vimcomments. |
|
9 |
+" https://git.rcrnstn.net/rcrnstn/vim-unobtrusive-comment. |
|
10 | 10 |
|
11 | 11 |
" Section headings are not written in |notation|, but are instead indicated |
12 | 12 |
" with multiple comment characters, which can form folds with |
13 |
-" https://git.rcrnstn.net/rcrnstn/vim-unobtrusive-folds. |
|
13 |
+" https://git.rcrnstn.net/rcrnstn/vim-unobtrusive-fold. |
|
14 | 14 |
|
15 | 15 |
""" Compatibility |
16 | 16 |
|
... | ... |
@@ -18,14 +18,14 @@ |
18 | 18 |
" - Features: tiny, huge (Debian `apt-get install vim-{tiny,gtk3}`) |
19 | 19 |
" - Encodings/Locales: C, UTF-8 (`LC_ALL=C{,.UFT-8}`) |
20 | 20 |
" - Colors: 1, 2, 8, 16, 256, termguicolors (`--cmd "set t_Co=$colors"`) |
21 |
-" - Terminals: GUI, VTE, Linux, tmux with the correct `Ss` terminal-override |
|
21 |
+" - Terminals: GUI, VTE, Linux, tmux with the correct `Ss` `terminal-override` |
|
22 | 22 |
" for the outer terminal |
23 | 23 |
" - Platforms: Linux |
24 | 24 |
|
25 | 25 |
""" Features |
26 | 26 |
|
27 | 27 |
" |:version| says "tiny" features are always present and are therefore used in |
28 |
-" favor of more advanced features whenever possible. These include: |
|
28 |
+" favor of more advanced features whenever possible. "Tiny" features include: |
|
29 | 29 |
" - |+multi_byte| |
30 | 30 |
" - |+mouse| |
31 | 31 |
" - |+tag_binary| |
... | ... |
@@ -127,7 +127,11 @@ set mouse=a |
127 | 127 |
""" Command-line |
128 | 128 |
set wildmenu |
129 | 129 |
set wildmode=longest:full,full |
130 |
-set wildignore=.git,_*,node_modules |
|
130 |
+set wildignore=_*,.git,.cache,.vagrant,.ansible,.npm,node_modules,pipx,snap |
|
131 |
+if has('patch-8.2.4325') |
|
132 |
+ " See http://ftp.vim.org/pub/vim/patches/8.2/8.2.4325. |
|
133 |
+ set wildoptions+=pum |
|
134 |
+endif |
|
131 | 135 |
|
132 | 136 |
""" Search |
133 | 137 |
set incsearch |
... | ... |
@@ -142,6 +146,12 @@ set ttimeoutlen=100 |
142 | 146 |
""" Diffs |
143 | 147 |
set diffopt+=vertical |
144 | 148 |
set diffopt+=foldcolumn:0 |
149 |
+if has('patch-8.1.0360') |
|
150 |
+ " See http://ftp.vim.org/pub/vim/patches/8.1/8.1.0360. |
|
151 |
+ set diffopt+=internal |
|
152 |
+ set diffopt+=algorithm:histogram |
|
153 |
+ set diffopt+=indent-heuristic |
|
154 |
+endif |
|
145 | 155 |
|
146 | 156 |
""" Formatting |
147 | 157 |
" See |auto-format|, |format-comments|, and |fo-table|. |
... | ... |
@@ -161,7 +171,7 @@ set foldtext=substitute(getline(v:foldstart),'\\t',repeat('\ ',&ts),'g').'\ ' |
161 | 171 |
|
162 | 172 |
""" Spelling |
163 | 173 |
set spell |
164 |
-set spelllang=en_us " May my ancestors forgive me. |
|
174 |
+set spelllang=en_us |
|
165 | 175 |
if has('eval') |
166 | 176 |
" Files downloaded from URL documented in |'thesaurus'|: |
167 | 177 |
" https://github.com/vim/vim/issues/629#issuecomment-443293282. |
... | ... |
@@ -193,21 +203,29 @@ tnoremap <C-J> <C-W>j |
193 | 203 |
tnoremap <C-K> <C-W>k |
194 | 204 |
tnoremap <C-L> <C-W>l |
195 | 205 |
|
206 |
+""" Buffers |
|
207 |
+nnoremap <Space>bb :ls<CR>:b<Space> |
|
208 |
+nnoremap <Space>bs :ls<CR>:sb<Space> |
|
209 |
+nnoremap <Space>bv :ls<CR>:vertical sb<Space> |
|
210 |
+ |
|
196 | 211 |
""" `$MYVIMRC` |
197 | 212 |
nnoremap <silent> <Space>ve :edit $MYVIMRC<CR> |
198 | 213 |
nnoremap <silent> <Space>vs :source $MYVIMRC<CR> |
199 | 214 |
|
200 |
-""" Run command |
|
201 |
-nnoremap <Space>! :new \| .! |
|
215 |
+""" Help |
|
216 |
+nnoremap <silent> gK :helpgrep <C-R><C-W><CR> |
|
217 |
+xnoremap <silent> gK y:helpgrep <C-R>"<CR> |
|
218 |
+ |
|
219 |
+""" Run |
|
202 | 220 |
|
203 |
-""" Run file |
|
221 |
+" File. |
|
204 | 222 |
nnoremap <silent> <Space>% :!%:p:S<CR> |
205 | 223 |
nnoremap <silent> <Space># :!#:p:S<CR> |
206 | 224 |
|
207 |
-""" Run `diff` |
|
208 |
-nnoremap <silent> <Space>d :w !diff --color -u %:S -<CR> |
|
225 |
+" Command. |
|
226 |
+nnoremap <Space>! :new \| .! |
|
209 | 227 |
|
210 |
-""" Run `make` |
|
228 |
+""" Make |
|
211 | 229 |
" TODO: |dispatch| provides default mappings, try to emulate them? |
212 | 230 |
nnoremap <Space>m% :!make %:r:S<CR> |
213 | 231 |
nnoremap <Space>m# :!make #:r:S<CR> |
... | ... |
@@ -236,12 +254,12 @@ nnoremap <silent> ZZ :quit<CR> |
236 | 254 |
nnoremap <silent> ZQ :quit<CR> |
237 | 255 |
|
238 | 256 |
"""" Easier access to black hole register with U |
239 |
-" This overrides the built-in "undo all on line". It is weird, counts as a |
|
240 |
-" change, and nobody uses it anyway. |
|
257 |
+" Overrides the built-in "undo all on line". It is weird, counts as a change, |
|
258 |
+" and nobody uses it anyway. |
|
241 | 259 |
nnoremap U "_ |
242 | 260 |
|
243 | 261 |
""""" Yank to end of line, not entire line |
244 |
-" As suggested in |Y|. This is analogous with |D| does `d$` and |C| does `c$`. |
|
262 |
+" As suggested in |Y|. Analogous with |D| does `d$` and |C| does `c$`. |
|
245 | 263 |
nnoremap Y y$ |
246 | 264 |
|
247 | 265 |
"""" Don't include newline in Visual mode `$`. |
... | ... |
@@ -251,9 +269,9 @@ xnoremap $ $h |
251 | 269 |
xnoremap p pgvy |
252 | 270 |
|
253 | 271 |
"""" Visually select last pasted text |
254 |
-" This is analogous with how |gv| visually selects last visually selected |
|
255 |
-" text. Default to always using ordinary Visual mode. Linewise and blockwise |
|
256 |
-" with |+eval| support. |
|
272 |
+" Analogous with how |gv| visually selects last visually selected text. Default |
|
273 |
+" to always using ordinary Visual mode. Linewise and blockwise with |+eval| |
|
274 |
+" support. |
|
257 | 275 |
nnoremap gp `[v`] |
258 | 276 |
if has('eval') |
259 | 277 |
nnoremap <expr> gp '`[' . getregtype()[0] . '`]' |
... | ... |
@@ -285,6 +303,27 @@ if has('eval') |
285 | 303 |
endfunction |
286 | 304 |
endif |
287 | 305 |
|
306 |
+""" Diffs |
|
307 |
+ |
|
308 |
+" Current file. |
|
309 |
+nnoremap <silent> <Space>dd :w !diff --color -u %:S -<CR> |
|
310 |
+ |
|
311 |
+" Analogous with |dp| |do| in Normal mode. |
|
312 |
+nnoremap <silent> <Space>dpp :.diffput<CR> |
|
313 |
+nnoremap <silent> <Space>doo :.diffget<CR> |
|
314 |
+xnoremap <silent> <Space>dp :diffput<CR> |
|
315 |
+xnoremap <silent> <Space>do :diffget<CR> |
|
316 |
+nnoremap <silent> <Space>dp :set operatorfunc=<SID>diffput<CR>g@ |
|
317 |
+nnoremap <silent> <Space>do :set operatorfunc=<SID>diffget<CR>g@ |
|
318 |
+if has('eval') |
|
319 |
+ function! s:diffput(...) abort |
|
320 |
+ '[,']diffput |
|
321 |
+ endfunction |
|
322 |
+ function! s:diffget(...) abort |
|
323 |
+ '[,']diffget |
|
324 |
+ endfunction |
|
325 |
+endif |
|
326 |
+ |
|
288 | 327 |
""" Formatting |
289 | 328 |
|
290 | 329 |
" Format comment (only). NOTE that this requires a `gc` comment text object |
... | ... |
@@ -292,6 +331,9 @@ endif |
292 | 331 |
nmap gQ gqgc |
293 | 332 |
nmap gW gwgc |
294 | 333 |
|
334 |
+""" Comments |
|
335 |
+set commentstring= |
|
336 |
+ |
|
295 | 337 |
""" Folds |
296 | 338 |
|
297 | 339 |
" Focus current fold. |
... | ... |
@@ -341,7 +383,7 @@ augroup END |
341 | 383 |
|
342 | 384 |
"" Auto commands |
343 | 385 |
|
344 |
-""" Open the quickfix/location list window automatically. |
|
386 |
+""" Open the QuickFix/Location list window automatically. |
|
345 | 387 |
" See |
346 | 388 |
" - https://github.com/tpope/vim-dispatch/issues/145 |
347 | 389 |
" - https://github.com/tpope/vim-dispatch/issues/254 |
... | ... |
@@ -373,7 +415,7 @@ autocmd BufWinLeave * |
373 | 415 |
""" Defaults |
374 | 416 |
" See |:hi-normal|, |:hi-normal-cterm|. |
375 | 417 |
|
376 |
-"""" Dark background and light foreground. |
|
418 |
+" Dark background and light foreground. |
|
377 | 419 |
set background=dark |
378 | 420 |
highlight! Normal guibg=#303030 guifg=#c6c6c6 ctermfg=White |
379 | 421 |
|
... | ... |
@@ -466,21 +508,26 @@ if has('eval') |
466 | 508 |
|
467 | 509 |
""" Built-in `vim` |
468 | 510 |
|
511 |
+ " See |ft-vim-indent|. |
|
469 | 512 |
let g:vim_indent_cont = 0 |
470 | 513 |
|
514 |
+ """ Built-in `sh` |
|
515 |
+ |
|
516 |
+ " See |ft-sh-syntax|. |
|
517 |
+ let g:is_posix = 1 |
|
518 |
+ |
|
471 | 519 |
""" Built-in `man` |
472 | 520 |
|
521 |
+ " See |ft-man-plugin|. |
|
473 | 522 |
let g:ft_man_folding_enable = 1 |
474 | 523 |
runtime ftplugin/man.vim |
475 | 524 |
set keywordprg=:Man |
476 | 525 |
|
477 |
- """ Built-in `markdown` |
|
478 |
- |
|
479 |
- let g:vim_markdown_no_default_key_mappings = 1 |
|
480 |
- |
|
481 | 526 |
""" `sheerun/vim-polyglot` |
482 | 527 |
PackAdd https://github.com/sheerun/vim-polyglot |
483 | 528 |
|
529 |
+ let g:vim_markdown_no_default_key_mappings = 1 |
|
530 |
+ |
|
484 | 531 |
let g:polyglot_disabled = [ |
485 | 532 |
\ 'sensible', |
486 | 533 |
\ 'autoindent', |
... | ... |
@@ -495,6 +542,9 @@ if has('eval') |
495 | 542 |
""" `tpope/vim-scriptease` |
496 | 543 |
PackAdd https://github.com/tpope/vim-scriptease |
497 | 544 |
|
545 |
+ """ `jyscao/vim-greprtpscr` |
|
546 |
+ PackAdd https://github.com/jyscao/vim-greprtpscr |
|
547 |
+ |
|
498 | 548 |
""" `vimwiki/vimwiki` |
499 | 549 |
" PackAdd https://github.com/vimwiki/vimwiki |
500 | 550 |
|
... | ... |
@@ -533,11 +583,35 @@ if has('eval') |
533 | 583 |
map <silent> zg* <Plug>(asterisk-gz*):set hlsearch<CR> |
534 | 584 |
map <silent> zg# <Plug>(asterisk-gz#):set hlsearch<CR> |
535 | 585 |
|
586 |
+ """ `AndrewRadev/splitjoin.vim` |
|
587 |
+ PackAdd https://github.com/AndrewRadev/splitjoin.vim |
|
588 |
+ |
|
589 |
+ """ `AndrewRadev/switch.vim` |
|
590 |
+ PackAdd https://github.com/AndrewRadev/switch.vim |
|
591 |
+ |
|
592 |
+ let g:switch_custom_definitions = [{ |
|
593 |
+ \ '\<0\>': '1', |
|
594 |
+ \ '\<1\>': '0', |
|
595 |
+ \ '\(\w*\)TRUE\(\w*\)': '\1FALSE\2', |
|
596 |
+ \ '\(\w*\)True\(\w*\)': '\1False\2', |
|
597 |
+ \ '\(\w*\)true\(\w*\)': '\1false\2', |
|
598 |
+ \ '\(\w*\)FALSE\(\w*\)': '\1TRUE\2', |
|
599 |
+ \ '\(\w*\)False\(\w*\)': '\1True\2', |
|
600 |
+ \ '\(\w*\)false\(\w*\)': '\1true\2', |
|
601 |
+ \ }] |
|
602 |
+ |
|
536 | 603 |
"" Insert mode |
537 | 604 |
|
538 | 605 |
""" `tpope/vim-endwise` |
539 | 606 |
PackAdd https://github.com/tpope/vim-endwise |
540 | 607 |
|
608 |
+ """ `jiangmiao/auto-pairs` |
|
609 |
+ PackAdd https://github.com/jiangmiao/auto-pairs |
|
610 |
+ |
|
611 |
+ " Don't jump around too much. See |autopairs-options|. |
|
612 |
+ let g:AutoPairsCenterLine = 0 |
|
613 |
+ let g:AutoPairsMultilineClose = 0 |
|
614 |
+ |
|
541 | 615 |
"" Command-line mode |
542 | 616 |
|
543 | 617 |
""" `tpope/vim-rsi` |
... | ... |
@@ -557,34 +631,53 @@ if has('eval') |
557 | 631 |
""" `tommcdo/vim-lion` |
558 | 632 |
PackAdd https://github.com/tommcdo/vim-lion |
559 | 633 |
|
634 |
+ let g:lion_squeeze_spaces = 1 |
|
635 |
+ |
|
636 |
+ """ `tommcdo/vim-nowchangethat` |
|
637 |
+ PackAdd https://github.com/tommcdo/vim-nowchangethat |
|
638 |
+ |
|
560 | 639 |
"" Motions / text objects |
561 | 640 |
|
562 | 641 |
""" `wellle/targets.vim` |
563 | 642 |
PackAdd https://github.com/wellle/targets.vim |
564 | 643 |
|
644 |
+ """ `bkad/CamelCaseMotion` |
|
645 |
+ PackAdd https://github.com/bkad/CamelCaseMotion |
|
646 |
+ |
|
647 |
+ let g:camelcasemotion_key = '<Space>' |
|
648 |
+ |
|
649 |
+ """ `tommcdo/vim-exchange` |
|
650 |
+ PackAdd https://github.com/tommcdo/vim-exchange |
|
651 |
+ |
|
565 | 652 |
""" `qstrahl/vim-dentures` |
566 | 653 |
PackAdd https://github.com/qstrahl/vim-dentures |
567 | 654 |
|
568 | 655 |
""" `kana/vim-textobj-user` |
569 | 656 |
PackAdd https://github.com/kana/vim-textobj-user |
570 | 657 |
|
658 |
+ """ `kana/vim-textobj-entire` |
|
659 |
+ PackAdd https://github.com/kana/vim-textobj-entire |
|
660 |
+ |
|
571 | 661 |
""" `kana/vim-textobj-line` |
572 | 662 |
PackAdd https://github.com/kana/vim-textobj-line |
573 | 663 |
|
664 |
+ " As suggested in |textobj-line-default-key-mappings|, except `{a,i}l` is |
|
665 |
+ " taken by `targets` "last", so we use uppercase `{a,i}L`. |
|
666 |
+ let g:textobj_line_no_default_key_mappings = 1 |
|
667 |
+ omap aL <Plug>(textobj-line-a) |
|
668 |
+ omap iL <Plug>(textobj-line-i) |
|
669 |
+ xmap aL <Plug>(textobj-line-a) |
|
670 |
+ xmap iL <Plug>(textobj-line-i) |
|
671 |
+ |
|
574 | 672 |
""" `kana/vim-textobj-fold` |
575 | 673 |
PackAdd https://github.com/kana/vim-textobj-fold |
576 | 674 |
|
675 |
+ """ `kana/vim-textobj-syntax` |
|
676 |
+ PackAdd https://github.com/kana/vim-textobj-syntax |
|
677 |
+ |
|
577 | 678 |
""" `idbrii/textobj-word-column.vim` |
578 | 679 |
PackAdd https://github.com/idbrii/textobj-word-column.vim |
579 | 680 |
|
580 |
- """ `bkad/CamelCaseMotion` |
|
581 |
- PackAdd https://github.com/bkad/CamelCaseMotion |
|
582 |
- |
|
583 |
- let g:camelcasemotion_key = '<Space>' |
|
584 |
- |
|
585 |
- """ `tommcdo/vim-exchange` |
|
586 |
- PackAdd https://github.com/tommcdo/vim-exchange |
|
587 |
- |
|
588 | 681 |
"" Colors |
589 | 682 |
|
590 | 683 |
""" `gruvbox-community/gruvbox` |
... | ... |
@@ -607,12 +700,13 @@ if has('eval') |
607 | 700 |
|
608 | 701 |
"" Folds |
609 | 702 |
|
610 |
- """ `rcrnstn/vim-unobtrusive-foldexpr` |
|
611 |
- PackAdd https://git.rcrnstn.net/rcrnstn/vim-foldexpr-unobtrusive |
|
703 |
+ """ `rcrnstn/vim-unobtrusive-fold` |
|
704 |
+ PackAdd https://git.rcrnstn.net/rcrnstn/vim-unobtrusive-fold |
|
612 | 705 |
|
613 |
- " autocmd vimrc VimEnter * set commentstring= |
|
614 |
- " autocmd vimrc FileType * call foldexpr_unobtrusive#commentstring(&commentstring) |
|
615 |
- " autocmd vimrc FileType markdown call foldexpr_unobtrusive#char('#') |
|
706 |
+ "" Undo |
|
707 |
+ |
|
708 |
+ """ `mbbill/undotree` |
|
709 |
+ PackAdd https://github.com/mbbill/undotree |
|
616 | 710 |
|
617 | 711 |
"" QuickFix |
618 | 712 |
|
... | ... |
@@ -620,27 +714,45 @@ if has('eval') |
620 | 714 |
|
621 | 715 |
packadd! cfilter |
622 | 716 |
|
717 |
+ "" Modelines |
|
718 |
+ |
|
719 |
+ """ `ypcrts/securemodelines` |
|
720 |
+ PackAdd https://github.com/ypcrts/securemodelines |
|
721 |
+ |
|
623 | 722 |
"" Operating system interaction |
624 | 723 |
|
625 | 724 |
""" `ctrlpvim/ctrlp.vim` |
626 | 725 |
PackAdd https://github.com/ctrlpvim/ctrlp.vim |
627 | 726 |
|
628 |
- let g:ctrlp_use_caching = 0 |
|
629 |
- let g:ctrlp_working_path_mode = 'a' |
|
727 |
+ let g:ctrlp_working_path_mode = '' |
|
728 |
+ let g:ctrlp_match_current_file = 1 |
|
630 | 729 |
let g:ctrlp_follow_symlinks = 1 |
730 |
+ let g:ctrlp_show_hidden = 1 |
|
631 | 731 |
let g:ctrlp_status_func = '' |
632 | 732 |
let g:ctrlp_line_prefix = '' |
733 |
+ let g:ctrlp_use_caching = 0 |
|
734 |
+ let g:ctrlp_max_files = 10000 " Default 10000. |
|
735 |
+ let g:ctrlp_max_depth = 40 " Default 40. |
|
633 | 736 |
if has('unix') |
634 | 737 |
let g:ctrlp_user_command = 'find -L %s' . |
635 |
- \ ' \( -false' . |
|
636 |
- \ join(map(split(&wildignore, ','), '" -o -name " . shellescape(v:val)')) . |
|
738 |
+ \ ' -maxdepth ' . g:ctrlp_max_depth . |
|
739 |
+ \ ' \( -false ' . |
|
740 |
+ \ (g:ctrlp_show_hidden ? '' : '-o -name ".*" ') . |
|
741 |
+ \ join(map(split(&wildignore, ','), '"-o -name " . shellescape(v:val)')) . |
|
637 | 742 |
\ ' \) -prune' . |
638 |
- \ ' -o -type f -exec grep -Il . {} +' |
|
743 |
+ \ ' -o -type f -exec grep -Il . {} +' . |
|
744 |
+ \ ' 2> /dev/null' . |
|
745 |
+ \ ' | head -n ' . g:ctrlp_max_files |
|
639 | 746 |
endif |
640 | 747 |
|
641 | 748 |
""" `tpope/vim-fugitive` |
642 | 749 |
PackAdd https://github.com/tpope/vim-fugitive |
643 | 750 |
|
751 |
+ autocmd vimrc FileType fugitiveblame call fugitive#MapJumps() |
|
752 |
+ |
|
753 |
+ """ `tommcdo/vim-fugitive-blame-ext` |
|
754 |
+ PackAdd https://github.com/tommcdo/vim-fugitive-blame-ext |
|
755 |
+ |
|
644 | 756 |
""" `tpope/vim-dispatch` |
645 | 757 |
PackAdd https://github.com/tpope/vim-dispatch |
646 | 758 |
|
... | ... |
@@ -653,6 +765,9 @@ if has('eval') |
653 | 765 |
""" `tpope/vim-eunuch` |
654 | 766 |
PackAdd https://github.com/tpope/vim-eunuch |
655 | 767 |
|
768 |
+ """ `tpope/vim-projectionist` |
|
769 |
+ PackAdd https://github.com/tpope/vim-projectionist |
|
770 |
+ |
|
656 | 771 |
"" Debugging |
657 | 772 |
|
658 | 773 |
""" `puremourning/vimspector` |
... | ... |
@@ -684,9 +799,18 @@ autocmd vimrc FileType * |
684 | 799 |
\ setlocal omnifunc=syntaxcomplete#Complete | |
685 | 800 |
\ endif | |
686 | 801 |
|
802 |
+" As suggested in |unobtrusive-fold-config|. |
|
803 |
+" autocmd vimrc FileType * UnobtrusiveFoldComment |
|
804 |
+" autocmd vimrc FileType markdown UnobtrusiveFoldChar # |
|
805 |
+" autocmd vimrc FileType * call foldexpr_unobtrusive#commentstring(&commentstring) |
|
806 |
+" autocmd vimrc FileType markdown call foldexpr_unobtrusive#char('#') |
|
807 |
+ |
|
687 | 808 |
autocmd vimrc FileType vim |
688 | 809 |
\ setlocal formatoptions-=r |
689 | 810 |
|
811 |
+autocmd vimrc FileType help |
|
812 |
+\ setlocal nolist |
|
813 |
+ |
|
690 | 814 |
autocmd vimrc FileType man |
691 | 815 |
\ setlocal nolist |
692 | 816 |
|