Robert Cranston authored on 23/12/2022 04:55:38
Showing 1 changed files
... ...
@@ -120,6 +120,7 @@ set listchars=tab:├\ ┤,trail:•,extends:›,precedes:‹,nbsp:·
120 120
 set showbreak=»\ |
121 121
 
122 122
 """ Colors
123
+set background=dark
123 124
 if has('gui_running')
124 125
   set t_Co=16777216
125 126
 endif
... ...
@@ -430,27 +431,20 @@ autocmd vimrc BufWinLeave *
430 431
 \ endif |
431 432
 
432 433
 """ Don't show extra things in special buffers
434
+" TODO: This needs to be moved to after the plugins for it to work in e.g.
435
+" fugitive?
433 436
 autocmd vimrc WinEnter,TerminalWinOpen *
434 437
 \ if &buftype !=# '' |
435 438
 \   silent setlocal nolist nospell |
436 439
 \ endif
437 440
 
438 441
 "" Colors
439
-" See |cterm-colors|, |gui-colors|. The greyscale hex values used for the GUI
440
-" are CIELCHuv lightness 20, 60 and 80.
441
-
442
-""" Defaults
443
-" See |:hi-normal|, |:hi-normal-cterm|.
444
-
445
-" Dark background and light foreground.
446
-set background=dark
447
-highlight! Normal guibg=#303030 guifg=#c6c6c6 ctermfg=White
442
+" See |cterm-colors|, |gui-colors|.
448 443
 
449 444
 """ Overrides
450
-
451
-"""" Transparency
452
-" Greyscale interface, dark red errors/warnings, light red spelling errors,
453
-" bold white todos.
445
+" Transparent background, greyscale interface. Sensible errors/warnings,
446
+" spellchecking, diffs, comments, and todos. See |:hi-normal| and
447
+" |:hi-normal-cterm|.
454 448
 
455 449
 if !has('gui_running')
456 450
   autocmd vimrc VimEnter,ColorScheme *
... ...
@@ -458,54 +452,46 @@ if !has('gui_running')
458 452
 endif
459 453
 
460 454
 " TODO: Look at all in |'highlight'|.
461
-" TODO: If we decide that we want `OptionSet` here as well, make these commands
462
-" |silent| as they clear the command line row otherwise.
463
-autocmd vimrc VimEnter,ColorScheme *
464
-\ highlight! Normal           term=NONE cterm=NONE gui=NONE ctermbg=NONE |
465
-\ highlight! LineNr           term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=Grey     guifg=Grey     |
466
-\ highlight! FoldColumn       term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=Grey     guifg=Grey     |
467
-\ highlight! SignColumn       term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=Grey     guifg=Grey     |
468
-\ highlight! VertSplit        term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=Grey     guifg=Grey     |
469
-\ highlight! StatusLine       term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=White    guifg=White    |
470
-\ highlight! StatusLineNC     term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=Grey     guifg=Grey     |
471
-\ highlight! StatusLineTerm   term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=White    guifg=White    |
472
-\ highlight! StatusLineTermNC term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=Grey     guifg=Grey     |
473
-\ highlight! TabLine          term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=Grey     guifg=Grey     |
474
-\ highlight! TabLineFill      term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=Grey     guifg=Grey     |
475
-\ highlight! TabLineSel       term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=White    guifg=White    |
476
-\ highlight! EndOfBuffer      term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=Black    guifg=Black    |
477
-\ highlight! Error            term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=DarkRed  guifg=Red      |
478
-\ highlight! ErrorMsg         term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=DarkRed  guifg=Red      |
479
-\ highlight! WarningMsg       term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=DarkRed  guifg=Red      |
480
-\ highlight! SpellBad         term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=LightRed guifg=LightRed |
481
-\ highlight! SpellLocal       term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=LightRed guifg=LightRed |
482
-\ highlight! SpellRare        term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=LightRed guifg=LightRed |
483
-\ highlight! SpellCap         term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=LightRed guifg=LightRed |
484
-\ highlight! Todo             term=bold cterm=bold gui=NONE ctermbg=NONE guibg=NONE ctermfg=White    guifg=White    |
485
-
486
-"""" Diffs
487 455
 autocmd vimrc VimEnter,ColorScheme *
488
-\ highlight! DiffAdd          term=NONE cterm=NONE gui=NONE ctermfg=Black guifg=Black ctermbg=DarkGreen  guibg=Green  |
489
-\ highlight! DiffDelete       term=NONE cterm=NONE gui=NONE ctermfg=Black guifg=Black ctermbg=DarkRed    guibg=Red    |
490
-\ highlight! DiffChange       term=NONE cterm=NONE gui=NONE ctermfg=Black guifg=Black ctermbg=DarkBlue   guibg=Blue   |
491
-\ highlight! DiffText         term=NONE cterm=NONE gui=NONE ctermfg=Black guifg=Black ctermbg=DarkYellow guibg=Yellow |
492
-\ highlight! diffAdded        term=NONE cterm=NONE gui=NONE ctermbg=NONE  guibg=NONE  ctermfg=DarkGreen  guifg=Green  |
493
-\ highlight! diffRemoved      term=NONE cterm=NONE gui=NONE ctermbg=NONE  guibg=NONE  ctermfg=DarkRed    guifg=Red    |
494
-
495
-"""" Comments
456
+\ highlight! Normal           term=NONE cterm=NONE gui=NONE ctermbg=NONE                    ctermfg=White                    |
457
+\ highlight! Comment          term=NONE cterm=NONE gui=NONE ctermbg=NONE       guibg=NONE   ctermfg=Grey                     |
458
+\ highlight! Todo             term=bold cterm=bold gui=bold ctermbg=NONE       guibg=NONE   ctermfg=White                    |
459
+\ highlight! LineNr           term=NONE cterm=NONE gui=NONE ctermbg=NONE       guibg=NONE   ctermfg=Grey      guifg=Grey     |
460
+\ highlight! FoldColumn       term=NONE cterm=NONE gui=NONE ctermbg=NONE       guibg=NONE   ctermfg=Grey      guifg=Grey     |
461
+\ highlight! SignColumn       term=NONE cterm=NONE gui=NONE ctermbg=NONE       guibg=NONE   ctermfg=Grey      guifg=Grey     |
462
+\ highlight! VertSplit        term=NONE cterm=NONE gui=NONE ctermbg=NONE       guibg=NONE   ctermfg=Grey      guifg=Grey     |
463
+\ highlight! StatusLine       term=NONE cterm=NONE gui=NONE ctermbg=NONE       guibg=NONE   ctermfg=White     guifg=White    |
464
+\ highlight! StatusLineNC     term=NONE cterm=NONE gui=NONE ctermbg=NONE       guibg=NONE   ctermfg=Grey      guifg=Grey     |
465
+\ highlight! StatusLineTerm   term=NONE cterm=NONE gui=NONE ctermbg=NONE       guibg=NONE   ctermfg=White     guifg=White    |
466
+\ highlight! StatusLineTermNC term=NONE cterm=NONE gui=NONE ctermbg=NONE       guibg=NONE   ctermfg=Grey      guifg=Grey     |
467
+\ highlight! TabLine          term=NONE cterm=NONE gui=NONE ctermbg=NONE       guibg=NONE   ctermfg=Grey      guifg=Grey     |
468
+\ highlight! TabLineFill      term=NONE cterm=NONE gui=NONE ctermbg=NONE       guibg=NONE   ctermfg=Grey      guifg=Grey     |
469
+\ highlight! TabLineSel       term=NONE cterm=NONE gui=NONE ctermbg=NONE       guibg=NONE   ctermfg=White     guifg=White    |
470
+\ highlight! EndOfBuffer      term=NONE cterm=NONE gui=NONE ctermbg=NONE       guibg=NONE   ctermfg=Black     guifg=Black    |
471
+\ highlight! Error            term=NONE cterm=NONE gui=NONE ctermbg=NONE       guibg=NONE   ctermfg=DarkRed   guifg=Red      |
472
+\ highlight! ErrorMsg         term=NONE cterm=NONE gui=NONE ctermbg=NONE       guibg=NONE   ctermfg=DarkRed   guifg=Red      |
473
+\ highlight! WarningMsg       term=NONE cterm=NONE gui=NONE ctermbg=NONE       guibg=NONE   ctermfg=DarkRed   guifg=Red      |
474
+\ highlight! SpellBad         term=NONE cterm=NONE gui=NONE ctermbg=NONE       guibg=NONE   ctermfg=LightRed  guifg=LightRed |
475
+\ highlight! SpellLocal       term=NONE cterm=NONE gui=NONE ctermbg=NONE       guibg=NONE   ctermfg=LightRed  guifg=LightRed |
476
+\ highlight! SpellRare        term=NONE cterm=NONE gui=NONE ctermbg=NONE       guibg=NONE   ctermfg=LightRed  guifg=LightRed |
477
+\ highlight! SpellCap         term=NONE cterm=NONE gui=NONE ctermbg=NONE       guibg=NONE   ctermfg=LightRed  guifg=LightRed |
478
+\ highlight! DiffAdd          term=NONE cterm=NONE gui=NONE ctermbg=DarkGreen  guibg=Green  ctermfg=Black     guifg=Black    |
479
+\ highlight! DiffDelete       term=NONE cterm=NONE gui=NONE ctermbg=DarkRed    guibg=Red    ctermfg=Black     guifg=Black    |
480
+\ highlight! DiffChange       term=NONE cterm=NONE gui=NONE ctermbg=DarkBlue   guibg=Blue   ctermfg=Black     guifg=Black    |
481
+\ highlight! DiffText         term=NONE cterm=NONE gui=NONE ctermbg=DarkYellow guibg=Yellow ctermfg=Black     guifg=Black    |
482
+\ highlight! diffAdded        term=NONE cterm=NONE gui=NONE ctermbg=NONE       guibg=NONE   ctermfg=DarkGreen guifg=Green    |
483
+\ highlight! diffRemoved      term=NONE cterm=NONE gui=NONE ctermbg=NONE       guibg=NONE   ctermfg=DarkRed   guifg=Red      |
484
+
485
+""" |'listchars'|
496 486
 autocmd vimrc VimEnter,ColorScheme *
497
-\ highlight! Comment guifg=#919191 ctermfg=Grey
487
+\ highlight! link SpecialKey Special |
488
+\ highlight! link NonText    Special |
498 489
 
499
-"""" Folds
490
+""" Folds
500 491
 autocmd vimrc VimEnter,ColorScheme *
501 492
 \ highlight! link Folded Comment |
502 493
 
503
-"""" |'listchars'|
504
-autocmd vimrc VimEnter,ColorScheme *
505
-\ highlight! link SpecialKey Special |
506
-\ highlight! link NonText    Special |
507
-
508
-"""" Vim comments
494
+""" Vim comments
509 495
 autocmd vimrc VimEnter,ColorScheme *
510 496
 \ highlight! link vimCommentString vimComment |
511 497
 \ highlight! link vimCommentTitle  vimComment |
Robert Cranston authored on 23/12/2022 03:28:33
Showing 1 changed files
... ...
@@ -245,8 +245,8 @@ xnoremap <silent> gK y:helpgrep <C-R>"<CR>
245 245
 """ Run
246 246
 
247 247
 " File.
248
-nnoremap <silent> <Space><Space>% :!%:p:S<CR>
249
-nnoremap <silent> <Space><Space># :!#:p:S<CR>
248
+nnoremap <silent> <Space><Space>% :!%:p:S \| less -FR<CR>
249
+nnoremap <silent> <Space><Space># :!#:p:S \| less -FR<CR>
250 250
 
251 251
 " Command.
252 252
 nnoremap <Space><Space>! :new \| .!
... ...
@@ -254,12 +254,12 @@ nnoremap <Space><Space>! :new \| .!
254 254
 """ Make
255 255
 " TODO: |dispatch| provides default mappings, try to emulate them?
256 256
 " TODO: Should these be <silent> as well?
257
-nnoremap <Space><Space>m% :!make %:r:S<CR>
258
-nnoremap <Space><Space>m# :!make #:r:S<CR>
259
-nnoremap <Space><Space>mm :!make<CR>
260
-nnoremap <Space><Space>ma :!make all<CR>
261
-nnoremap <Space><Space>mt :!make test<CR>
262
-nnoremap <Space><Space>md :!make debug<CR>
257
+nnoremap <Space><Space>m% :!make %:r:S \| less -FR<CR>
258
+nnoremap <Space><Space>m# :!make #:r:S \| less -FR<CR>
259
+nnoremap <Space><Space>mm :!make       \| less -FR<CR>
260
+nnoremap <Space><Space>ma :!make all   \| less -FR<CR>
261
+nnoremap <Space><Space>mt :!make test  \| less -FR<CR>
262
+nnoremap <Space><Space>md :!make debug \| less -FR<CR>
263 263
 if has('quickfix')
264 264
   nnoremap <Space><Space>m% :silent make! %:r:S \| redraw!<CR>
265 265
   nnoremap <Space><Space>m# :silent make! #:r:S \| redraw!<CR>
... ...
@@ -332,7 +332,7 @@ endif
332 332
 """ Diffs
333 333
 
334 334
 " Current file.
335
-nnoremap <silent> <Space><Space>dd :w !diff --color -u %:S -<CR>
335
+nnoremap <silent> <Space><Space>dd :w !diff --color=always -u %:S - \| less -FR<CR>
336 336
 
337 337
 " Analogous with |dp| |do| in Normal mode.
338 338
 nnoremap <silent> <Space>dpp :.diffput<CR>
... ...
@@ -429,6 +429,12 @@ autocmd vimrc BufWinLeave *
429 429
 \   mkview |
430 430
 \ endif |
431 431
 
432
+""" Don't show extra things in special buffers
433
+autocmd vimrc WinEnter,TerminalWinOpen *
434
+\ if &buftype !=# '' |
435
+\   silent setlocal nolist nospell |
436
+\ endif
437
+
432 438
 "" Colors
433 439
 " See |cterm-colors|, |gui-colors|. The greyscale hex values used for the GUI
434 440
 " are CIELCHuv lightness 20, 60 and 80.
... ...
@@ -447,12 +453,14 @@ highlight! Normal guibg=#303030 guifg=#c6c6c6 ctermfg=White
447 453
 " bold white todos.
448 454
 
449 455
 if !has('gui_running')
450
-  autocmd vimrc VimEnter,ColorScheme,OptionSet *
456
+  autocmd vimrc VimEnter,ColorScheme *
451 457
   \ highlight! Normal guibg=NONE |
452 458
 endif
453 459
 
454 460
 " TODO: Look at all in |'highlight'|.
455
-autocmd vimrc VimEnter,ColorScheme,OptionSet *
461
+" TODO: If we decide that we want `OptionSet` here as well, make these commands
462
+" |silent| as they clear the command line row otherwise.
463
+autocmd vimrc VimEnter,ColorScheme *
456 464
 \ highlight! Normal           term=NONE cterm=NONE gui=NONE ctermbg=NONE |
457 465
 \ highlight! LineNr           term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=Grey     guifg=Grey     |
458 466
 \ highlight! FoldColumn       term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=Grey     guifg=Grey     |
... ...
@@ -476,7 +484,7 @@ autocmd vimrc VimEnter,ColorScheme,OptionSet *
476 484
 \ highlight! Todo             term=bold cterm=bold gui=NONE ctermbg=NONE guibg=NONE ctermfg=White    guifg=White    |
477 485
 
478 486
 """" Diffs
479
-autocmd vimrc VimEnter,ColorScheme,OptionSet *
487
+autocmd vimrc VimEnter,ColorScheme *
480 488
 \ highlight! DiffAdd          term=NONE cterm=NONE gui=NONE ctermfg=Black guifg=Black ctermbg=DarkGreen  guibg=Green  |
481 489
 \ highlight! DiffDelete       term=NONE cterm=NONE gui=NONE ctermfg=Black guifg=Black ctermbg=DarkRed    guibg=Red    |
482 490
 \ highlight! DiffChange       term=NONE cterm=NONE gui=NONE ctermfg=Black guifg=Black ctermbg=DarkBlue   guibg=Blue   |
... ...
@@ -485,20 +493,20 @@ autocmd vimrc VimEnter,ColorScheme,OptionSet *
485 493
 \ highlight! diffRemoved      term=NONE cterm=NONE gui=NONE ctermbg=NONE  guibg=NONE  ctermfg=DarkRed    guifg=Red    |
486 494
 
487 495
 """" Comments
488
-autocmd vimrc VimEnter,ColorScheme,OptionSet *
496
+autocmd vimrc VimEnter,ColorScheme *
489 497
 \ highlight! Comment guifg=#919191 ctermfg=Grey
490 498
 
491 499
 """" Folds
492
-autocmd vimrc VimEnter,ColorScheme,OptionSet *
500
+autocmd vimrc VimEnter,ColorScheme *
493 501
 \ highlight! link Folded Comment |
494 502
 
495 503
 """" |'listchars'|
496
-autocmd vimrc VimEnter,ColorScheme,OptionSet *
504
+autocmd vimrc VimEnter,ColorScheme *
497 505
 \ highlight! link SpecialKey Special |
498 506
 \ highlight! link NonText    Special |
499 507
 
500 508
 """" Vim comments
501
-autocmd vimrc VimEnter,ColorScheme,OptionSet *
509
+autocmd vimrc VimEnter,ColorScheme *
502 510
 \ highlight! link vimCommentString vimComment |
503 511
 \ highlight! link vimCommentTitle  vimComment |
504 512
 
... ...
@@ -565,7 +573,7 @@ if has('eval')
565 573
   GitAdd https://github.com/tpope/vim-scriptease
566 574
 
567 575
   """" `jyscao/vim-greprtpscr`
568
-  GitAdd https://github.com/jyscao/vim-greprtpscr
576
+  GitAdd! https://github.com/jyscao/vim-greprtpscr
569 577
 
570 578
   """" `vimwiki/vimwiki`
571 579
   " GitAdd https://github.com/vimwiki/vimwiki
... ...
@@ -873,12 +881,6 @@ endif
873 881
 autocmd vimrc FileType vim
874 882
 \ setlocal keywordprg=:help formatoptions-=r
875 883
 
876
-autocmd vimrc FileType help
877
-\ setlocal nolist
878
-
879
-autocmd vimrc FileType man
880
-\ setlocal nolist
881
-
882 884
 autocmd vimrc FileType c,cpp
883 885
 \ setlocal commentstring=//\ %s
884 886
 
... ...
@@ -888,10 +890,8 @@ autocmd vimrc FileType dot
888 890
 autocmd vimrc FileType markdown
889 891
 \ setlocal complete+=kspell
890 892
 
891
-autocmd vimrc FileType *
892
-\ if &buftype ==# 'nowrite' |
893
-\   setlocal nospell nolist |
894
-\ endif |
893
+autocmd vimrc FileType man
894
+\ setlocal nolist nospell
895 895
 
896 896
 " As suggested in |ft-syntax-omni|, use syntax completion if no other
897 897
 " completion has been defined.
Robert Cranston authored on 30/11/2022 22:55:45
Showing 1 changed files
... ...
@@ -4,47 +4,45 @@
4 4
 
5 5
 """ Comments
6 6
 
7
-" Comments are written in Vim's help |notation|, see |help-writing|, which can
8
-" be highlighted with
9
-" https://git.rcrnstn.net/rcrnstn/vim-unobtrusive-comment.
7
+" Comments are written in Vim's help |notation|, see |help-writing|. They can
8
+" be highlighted with https://git.rcrnstn.net/rcrnstn/vim-unobtrusive-comment.
10 9
 
11
-" Section headings are not written in |notation|, but are instead indicated
12
-" with multiple comment characters, which can form folds with
13
-" https://git.rcrnstn.net/rcrnstn/vim-unobtrusive-fold.
10
+" Section headings are not written in the help |notation|, but are instead
11
+" indicated with multiple contiguous comment characters. They can form folds
12
+" with https://git.rcrnstn.net/rcrnstn/vim-unobtrusive-fold.
14 13
 
15 14
 """ Compatibility
16 15
 
17 16
 " This vimrc should work with all configurations of Vim. Manually tested with:
18 17
 " - Features: tiny, huge (Debian `apt-get install vim-{tiny,gtk3}`)
19
-" - Encodings/Locales: C, UTF-8 (`LC_ALL=C{,.UFT-8}`)
20
-" - Colors: 1, 2, 8, 16, 256, termguicolors (`--cmd "set t_Co=$colors"`)
18
+" - Locales: C, UTF-8 (`LC_ALL=C{,.UFT-8}`)
19
+" - Colors: 1, 2, 8, 16, 256, termguicolors (`--cmd "set {t_Co=$colors,tgc}"`)
20
+" - UI: TUI, GUI (`{,g}vim`)
21 21
 " - Terminals: GUI, VTE, Linux, tmux with the correct `Ss` `terminal-override`
22
-" - Platforms: Linux
22
+" - Platforms: Unix-like
23 23
 
24 24
 """ Features
25 25
 
26 26
 " |:version| says "tiny" features are always present and are therefore used in
27
-" favor of more advanced features whenever possible. "Tiny" features include:
27
+" favor other features whenever possible. "Tiny" features include:
28 28
 " - |+multi_byte|
29 29
 " - |+mouse|
30 30
 " - |+tag_binary|
31 31
 " - |+user_commands|
32 32
 " - |+autocmd|
33 33
 " - |+localmap|
34
-" Important features that are only present in "normal":
35
-" - |+eval|
36 34
 
37
-" Note that trying to set unsupported options is silently ignored, and so can
38
-" be done without checking for support first (which is good, since that
39
-" requires |+eval|). Everything between |:if| and |:endif| is also silently
40
-" ignored if |+eval| is not available.
35
+" Note that trying to set (run-time, but not compile-time) unsupported options
36
+" is silently ignored, and so can be done without checking for support first
37
+" (which is good, since that requires |+eval|). Everything between |:if| and
38
+" |:endif| is also silently ignored if |+eval| is not available.
41 39
 
42 40
 """ Encoding
43 41
 
44 42
 " |'encoding'| is hard-coded to `utf-8`. However, only characters present in
45 43
 " Code Page 437 should be used in the interface, to ensure font support on most
46 44
 " terminals (in particular, the Linux console). See
47
-" - https://en.wikipedia.org/wiki/Code_page_347
45
+" - https://en.wikipedia.org/wiki/Code_page_437
48 46
 " - https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/tty/vt/cp437.uni
49 47
 " - `man showconsolefont`
50 48
 
... ...
@@ -53,19 +51,21 @@
53 51
 " |setglobal| is used where appropriate so that buffer/window-local options are
54 52
 " not overridden when re-sourcing.
55 53
 
56
-" At the time of writing, |augroup| messes up the highlighting of |autocmd|s
57
-" within it, so the `vimrc` group name is added to every |autocmd| instead (the
58
-" addition of the group of course makes the highlighting misinterpret it as the
54
+" A `vimrc` |augroup| is cleared and used for all |autocmd|s. At the time of
55
+" writing, |augroup| messes up the highlighting of |autocmd|s within it, so the
56
+" `vimrc` group name is added to every |autocmd| instead (the addition of the
57
+" group of course makes the highlighting misinterpret it as the
59 58
 " `vimAutoEventList` and the events instead get the erroneous
60
-" `VimAutoCmdSfxList`... file a bug?). This can be checked with `:g/autocmd`.
59
+" `VimAutoCmdSfxList` highlighting... file a bug?). This can be checked with
60
+" `:g/autocmd`.
61 61
 
62 62
 """ Mappings
63 63
 
64 64
 " Don't make any built-in mappings do something completely different! Another
65 65
 " Vimmer should never be surprised by what happens, unless it is pleasantly
66
-" because the functionality is extended in useful and obvious ways. This
67
-" includes mappings from popular plugins, for which the defaults should be kept
68
-" as far as possible.
66
+" surprised because the functionality is extended in useful and obvious ways.
67
+" This includes mappings from popular plugins, for which the defaults should be
68
+" kept as far as possible.
69 69
 
70 70
 " |<Leader>| is hard-coded to <Space> so that mappings work without |+eval|.
71 71
 " Setting |mapleader| to a different value after the mappings have been defined
... ...
@@ -123,7 +123,7 @@ set showbreak=»\ |
123 123
 if has('gui_running')
124 124
   set t_Co=16777216
125 125
 endif
126
-if 16 <= &t_Co && &t_Co <= 256
126
+if 16 <= &t_Co && &t_Co <= 256 && !&termguicolors
127 127
   set t_Co=16
128 128
 endif
129 129
 
... ...
@@ -143,7 +143,7 @@ set mouse=a
143 143
 """ Command-line
144 144
 set wildmenu
145 145
 set wildmode=longest:full,full
146
-set wildignore=_*,.git,.cache,.vagrant,.ansible,.npm,node_modules,pipx,snap
146
+set wildignore=_*,.git,.cache,.vagrant,.ansible,.npm,node_modules,__pycache__,.venv,*.egg-info,pipx,snap
147 147
 if has('patch-8.2.4325')
148 148
   " See http://ftp.vim.org/pub/vim/patches/8.2/8.2.4325.
149 149
   set wildoptions+=pum
... ...
@@ -172,6 +172,7 @@ endif
172 172
 """ Formatting
173 173
 " See |auto-format|, |format-comments|, and |fo-table|.
174 174
 set textwidth=79
175
+set winwidth=80
175 176
 " set colorcolumn=+1
176 177
 set autoindent
177 178
 set nojoinspaces
... ...
@@ -187,24 +188,29 @@ set commentstring=
187 188
 """ Folds
188 189
 set foldlevelstart=999
189 190
 set foldtext=substitute(getline(v:foldstart),'\\t',repeat('\ ',&ts),'g').'\ '
190
-if has('eval')
191
-  set foldtext=unobtrusive_fold#text()
192
-endif
193 191
 
194 192
 """ Spelling
195 193
 set spell
196 194
 set spelllang=en_us
197
-if has('eval')
198
-  " Files downloaded from URL documented in |'thesaurus'|:
199
-  " https://github.com/vim/vim/issues/629#issuecomment-443293282.
200
-  let &thesaurus = split(&runtimepath, ',')[0] . '/thesaurus/en_us.txt'
201
-endif
195
+" `thesaurus/en_us.txt` downloaded from URL documented in |'thesaurus'|:
196
+" https://github.com/vim/vim/issues/629#issuecomment-443293282.
197
+set thesaurus=~/.vim/thesaurus/en_us.txt
202 198
 
203 199
 """ Views
204 200
 set viewoptions-=options
205 201
 set viewoptions+=slash
206 202
 set viewoptions+=unix
207 203
 
204
+""" Files
205
+set swapfile
206
+set writebackup
207
+set undofile
208
+set directory=~/.cache/vim/swap//
209
+set backupdir=~/.cache/vim/backup//
210
+set undodir=~/.cache/vim/undo//
211
+set viewdir=~/.cache/vim/view//
212
+set viminfofile=~/.cache/vim/viminfo
213
+
208 214
 "" Mappings
209 215
 
210 216
 """ Escape
... ...
@@ -224,13 +230,13 @@ tnoremap <C-K> <C-W>k
224 230
 tnoremap <C-L> <C-W>l
225 231
 
226 232
 """ Buffers
227
-nnoremap <Space>bb :ls<CR>:b<Space>
228
-nnoremap <Space>bs :ls<CR>:sb<Space>
229
-nnoremap <Space>bv :ls<CR>:vertical sb<Space>
233
+nnoremap <Space><Space>bb :ls<CR>:b<Space>
234
+nnoremap <Space><Space>bs :ls<CR>:sb<Space>
235
+nnoremap <Space><Space>bv :ls<CR>:vertical sb<Space>
230 236
 
231 237
 """ `$MYVIMRC`
232
-nnoremap <silent> <Space>ve :edit   $MYVIMRC<CR>
233
-nnoremap <silent> <Space>vs :source $MYVIMRC<CR>
238
+nnoremap <silent> <Space><Space>ve :edit   $MYVIMRC<CR>
239
+nnoremap <silent> <Space><Space>vs :source $MYVIMRC<CR>
234 240
 
235 241
 """ Help
236 242
 nnoremap <silent> gK  :helpgrep \<<C-R><C-W>\><CR>
... ...
@@ -239,29 +245,30 @@ xnoremap <silent> gK y:helpgrep <C-R>"<CR>
239 245
 """ Run
240 246
 
241 247
 " File.
242
-nnoremap <silent> <Space>% :!%:p:S<CR>
243
-nnoremap <silent> <Space># :!#:p:S<CR>
248
+nnoremap <silent> <Space><Space>% :!%:p:S<CR>
249
+nnoremap <silent> <Space><Space># :!#:p:S<CR>
244 250
 
245 251
 " Command.
246
-nnoremap <Space>! :new \| .!
252
+nnoremap <Space><Space>! :new \| .!
247 253
 
248 254
 """ Make
249 255
 " TODO: |dispatch| provides default mappings, try to emulate them?
250
-nnoremap <Space>m% :!make %:r:S<CR>
251
-nnoremap <Space>m# :!make #:r:S<CR>
252
-nnoremap <Space>mm :!make<CR>
253
-nnoremap <Space>ma :!make all<CR>
254
-nnoremap <Space>mt :!make test<CR>
255
-nnoremap <Space>md :!make debug<CR>
256
+" TODO: Should these be <silent> as well?
257
+nnoremap <Space><Space>m% :!make %:r:S<CR>
258
+nnoremap <Space><Space>m# :!make #:r:S<CR>
259
+nnoremap <Space><Space>mm :!make<CR>
260
+nnoremap <Space><Space>ma :!make all<CR>
261
+nnoremap <Space><Space>mt :!make test<CR>
262
+nnoremap <Space><Space>md :!make debug<CR>
256 263
 if has('quickfix')
257
-  nnoremap <Space>m% :silent make! %:r:S \| redraw!<CR>
258
-  nnoremap <Space>m# :silent make! #:r:S \| redraw!<CR>
259
-  nnoremap <Space>mm :silent make!       \| redraw!<CR>
260
-  nnoremap <Space>ma :silent make! all   \| redraw!<CR>
261
-  nnoremap <Space>mt :silent make! test  \| redraw!<CR>
264
+  nnoremap <Space><Space>m% :silent make! %:r:S \| redraw!<CR>
265
+  nnoremap <Space><Space>m# :silent make! #:r:S \| redraw!<CR>
266
+  nnoremap <Space><Space>mm :silent make!       \| redraw!<CR>
267
+  nnoremap <Space><Space>ma :silent make! all   \| redraw!<CR>
268
+  nnoremap <Space><Space>mt :silent make! test  \| redraw!<CR>
262 269
 endif
263 270
 if has('terminal')
264
-  nnoremap <Space>md :terminal make debug<CR>
271
+  nnoremap <Space><Space>md :terminal make debug<CR>
265 272
 endif
266 273
 
267 274
 """ Improve default mappings
... ...
@@ -325,7 +332,7 @@ endif
325 332
 """ Diffs
326 333
 
327 334
 " Current file.
328
-nnoremap <silent> <Space>dd :w !diff --color -u %:S -<CR>
335
+nnoremap <silent> <Space><Space>dd :w !diff --color -u %:S -<CR>
329 336
 
330 337
 " Analogous with |dp| |do| in Normal mode.
331 338
 nnoremap <silent> <Space>dpp :.diffput<CR>
... ...
@@ -357,8 +364,8 @@ nnoremap zV zMzv
357 364
 
358 365
 " Focus next/previous fold. Overwrites default move to start/end of
359 366
 " next/previous fold.
360
-nnoremap zj zvm<zjzvm>gvzc'>zv
361
-nnoremap zk zvzcVoVgkzvgkzvzcVoVzv
367
+nnoremap <silent> zj m<zjzvm>gvzc'>zv
368
+nnoremap <silent> zk zvzckVzvV:<C-R>=prevnonblank(line('.'))<CR><CR>zvzcVoVzv
362 369
 
363 370
 " Open/close nested folds recursively. Overwrites default open/close fold under
364 371
 " cursor recursively.
... ...
@@ -468,10 +475,6 @@ autocmd vimrc VimEnter,ColorScheme,OptionSet *
468 475
 \ highlight! SpellCap         term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=LightRed guifg=LightRed |
469 476
 \ highlight! Todo             term=bold cterm=bold gui=NONE ctermbg=NONE guibg=NONE ctermfg=White    guifg=White    |
470 477
 
471
-"""" Comments
472
-autocmd vimrc VimEnter,ColorScheme,OptionSet *
473
-\ highlight! Comment guifg=#919191 ctermfg=Grey
474
-
475 478
 """" Diffs
476 479
 autocmd vimrc VimEnter,ColorScheme,OptionSet *
477 480
 \ highlight! DiffAdd          term=NONE cterm=NONE gui=NONE ctermfg=Black guifg=Black ctermbg=DarkGreen  guibg=Green  |
... ...
@@ -481,6 +484,10 @@ autocmd vimrc VimEnter,ColorScheme,OptionSet *
481 484
 \ highlight! diffAdded        term=NONE cterm=NONE gui=NONE ctermbg=NONE  guibg=NONE  ctermfg=DarkGreen  guifg=Green  |
482 485
 \ highlight! diffRemoved      term=NONE cterm=NONE gui=NONE ctermbg=NONE  guibg=NONE  ctermfg=DarkRed    guifg=Red    |
483 486
 
487
+"""" Comments
488
+autocmd vimrc VimEnter,ColorScheme,OptionSet *
489
+\ highlight! Comment guifg=#919191 ctermfg=Grey
490
+
484 491
 """" Folds
485 492
 autocmd vimrc VimEnter,ColorScheme,OptionSet *
486 493
 \ highlight! link Folded Comment |
... ...
@@ -667,6 +674,7 @@ if has('eval')
667 674
   GitAdd https://github.com/tommcdo/vim-exchange
668 675
 
669 676
   """" `qstrahl/vim-dentures`
677
+  " TODO: I'm not happy with this, replace.
670 678
   GitAdd https://github.com/qstrahl/vim-dentures
671 679
 
672 680
   """" `kana/vim-textobj-user`
... ...
@@ -735,12 +743,19 @@ if has('eval')
735 743
   """" `rcrnstn/vim-unobtrusive-fold`
736 744
   GitAdd https://git.rcrnstn.net/rcrnstn/vim-unobtrusive-fold
737 745
 
746
+  " As suggested in |unobtrusive_fold#text()|.
747
+  set foldtext=unobtrusive_fold#text()
748
+
749
+  " As suggested in |unobtrusive-fold-example|.
750
+  autocmd vimrc FileType *        UnobtrusiveFoldComment
751
+  autocmd vimrc FileType markdown UnobtrusiveFoldChar #
752
+
738 753
   """ Undo
739 754
 
740 755
   """" `mbbill/undotree`
741 756
   GitAdd https://github.com/mbbill/undotree
742 757
 
743
-  nnoremap <silent> <Space>u :UndotreeToggle<CR>
758
+  nnoremap <silent> <Space><Space>u :UndotreeToggle<CR>
744 759
 
745 760
   " let g:undotree_HighlightChangedText = 0
746 761
   " let g:undotree_DiffCommand = 'diff -u'
... ...
@@ -786,22 +801,22 @@ if has('eval')
786 801
   if has('unix')
787 802
     " TODO: Set `grepprg` to something similar, that skips things in
788 803
     " 'wildignore'.
789
-    " let g:ctrlp_user_command = 'find' .
790
-    " \ (g:ctrlp_follow_symlinks ? ' -L' : '') .
791
-    " \ ' %s' .
792
-    " \ ' -maxdepth ' . g:ctrlp_max_depth .
793
-    " \ ' \( -false' .
794
-    " \ (g:ctrlp_show_hidden ? '' : ' -o -name ".*"') .
795
-    " \ ' ' .
796
-    " \ join(map(split(&wildignore, ','), '"-o -name " . shellescape(v:val)')) .
797
-    " \ ' \) -prune -o' .
798
-    " \ ' -type f' .
804
+    let g:ctrlp_user_command = 'find' .
805
+    \ (g:ctrlp_follow_symlinks ? ' -L' : '') .
806
+    \ ' %s' .
807
+    \ ' -maxdepth ' . g:ctrlp_max_depth .
808
+    \ ' \( -false' .
809
+    \ (g:ctrlp_show_hidden ? '' : ' -o -name ".*"') .
810
+    \ ' ' .
811
+    \ join(map(split(&wildignore, ','), '"-o -name " . shellescape(v:val)')) .
812
+    \ ' \) -prune -o' .
813
+    \ ' -type f' .
814
+    \ ' 2> /dev/null' .
815
+    \ (g:ctrlp_max_files ? ' | head -n ' . g:ctrlp_max_files : '')
799 816
     " \ ' -exec grep -Il . {} +' .
800
-    " \ ' 2> /dev/null' .
801
-    " \ (g:ctrlp_max_files ? ' | head -n ' . g:ctrlp_max_files : '')
802
-    " " \ ' \(' .
803
-    " " \ (g:ctrlp_follow_symlinks == 2 ? ' -o -type l' : '') .
804
-    " " \ ' \)' .
817
+    " \ ' \(' .
818
+    " \ (g:ctrlp_follow_symlinks == 2 ? ' -o -type l' : '') .
819
+    " \ ' \)' .
805 820
   endif
806 821
 
807 822
   """" `tpope/vim-fugitive`
... ...
@@ -812,14 +827,18 @@ if has('eval')
812 827
   """" `tommcdo/vim-fugitive-blame-ext`
813 828
   GitAdd https://github.com/tommcdo/vim-fugitive-blame-ext
814 829
 
830
+  """" `iberianpig/tig-explorer.vim`
831
+  " GitAdd https://github.com/iberianpig/tig-explorer.vim
832
+
815 833
   """" `tpope/vim-dispatch`
816 834
   GitAdd https://github.com/tpope/vim-dispatch
817 835
 
818
-  nnoremap <Space>m% :Make %:r:S<CR>
819
-  nnoremap <Space>m# :Make #:r:S<CR>
820
-  nnoremap <Space>mm :Make<CR>
821
-  nnoremap <Space>ma :Make all<CR>
822
-  nnoremap <Space>mt :Make test<CR>
836
+  " TODO: Stick to the default mappings.
837
+  nnoremap <Space><Space>m% :Make %:r:S<CR>
838
+  nnoremap <Space><Space>m# :Make #:r:S<CR>
839
+  nnoremap <Space><Space>mm :Make<CR>
840
+  nnoremap <Space><Space>ma :Make all<CR>
841
+  nnoremap <Space><Space>mt :Make test<CR>
823 842
 
824 843
   """" `tpope/vim-eunuch`
825 844
   GitAdd https://github.com/tpope/vim-eunuch
... ...
@@ -841,7 +860,7 @@ if has('eval')
841 860
   " Common DeBugGer Protocol (DBGP) client. See
842 861
   " https://en.wikipedia.org/wiki/DBGp.
843 862
 
844
-endif " has('eval')
863
+endif "" has('eval')
845 864
 
846 865
 "" Syntax and file type
847 866
 if has('eval')
... ...
@@ -863,17 +882,24 @@ autocmd vimrc FileType man
863 882
 autocmd vimrc FileType c,cpp
864 883
 \ setlocal commentstring=//\ %s
865 884
 
885
+autocmd vimrc FileType dot
886
+\ setlocal commentstring=//\ %s
887
+
888
+autocmd vimrc FileType markdown
889
+\ setlocal complete+=kspell
890
+
891
+autocmd vimrc FileType *
892
+\ if &buftype ==# 'nowrite' |
893
+\   setlocal nospell nolist |
894
+\ endif |
895
+
866 896
 " As suggested in |ft-syntax-omni|, use syntax completion if no other
867 897
 " completion has been defined.
868 898
 autocmd vimrc FileType *
869
-\ if &omnifunc == '' |
899
+\ if &omnifunc ==# '' |
870 900
 \   setlocal omnifunc=syntaxcomplete#Complete |
871 901
 \ endif |
872 902
 
873
-" As suggested in |unobtrusive-fold-example|.
874
-autocmd vimrc FileType *        UnobtrusiveFoldComment
875
-autocmd vimrc FileType markdown UnobtrusiveFoldChar #
876
-
877 903
 "" Terminal overrides
878 904
 " See |terminal-options|.
879 905
 
Robert Cranston authored on 22/08/2022 22:38:54
Showing 1 changed files
... ...
@@ -19,7 +19,6 @@
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 21
 " - Terminals: GUI, VTE, Linux, tmux with the correct `Ss` `terminal-override`
22
-"   for the outer terminal
23 22
 " - Platforms: Linux
24 23
 
25 24
 """ Features
... ...
@@ -35,8 +34,6 @@
35 34
 " Important features that are only present in "normal":
36 35
 " - |+eval|
37 36
 
38
-" |<Leader>| is hard-coded to <Space> so that mappings work without |+eval|.
39
-
40 37
 " Note that trying to set unsupported options is silently ignored, and so can
41 38
 " be done without checking for support first (which is good, since that
42 39
 " requires |+eval|). Everything between |:if| and |:endif| is also silently
... ...
@@ -51,15 +48,33 @@
51 48
 " - https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/tty/vt/cp437.uni
52 49
 " - `man showconsolefont`
53 50
 
54
-""" Auto commands
51
+""" Re-sourcing
52
+
53
+" |setglobal| is used where appropriate so that buffer/window-local options are
54
+" not overridden when re-sourcing.
55 55
 
56 56
 " At the time of writing, |augroup| messes up the highlighting of |autocmd|s
57 57
 " within it, so the `vimrc` group name is added to every |autocmd| instead (the
58 58
 " addition of the group of course makes the highlighting misinterpret it as the
59 59
 " `vimAutoEventList` and the events instead get the erroneous
60
-" `VimAutoCmdSfxList`... file a bug?). Don't forget!
60
+" `VimAutoCmdSfxList`... file a bug?). This can be checked with `:g/autocmd`.
61
+
62
+""" Mappings
63
+
64
+" Don't make any built-in mappings do something completely different! Another
65
+" Vimmer should never be surprised by what happens, unless it is pleasantly
66
+" because the functionality is extended in useful and obvious ways. This
67
+" includes mappings from popular plugins, for which the defaults should be kept
68
+" as far as possible.
69
+
70
+" |<Leader>| is hard-coded to <Space> so that mappings work without |+eval|.
71
+" Setting |mapleader| to a different value after the mappings have been defined
72
+" does not change the mappings, so it is not possible to "hot-swap" it for pair
73
+" programming anyway.
61 74
 
62 75
 "" Options
76
+" TODO: Use |setglobal| for more things? Note that for options with a non-empty
77
+" default local value, `setglobal` does nothing useful.
63 78
 
64 79
 """ Reset
65 80
 " set all&
... ...
@@ -93,8 +108,9 @@ set guioptions=cf
93 108
 
94 109
 """ Interface characters
95 110
 " If |'t_Co'| is empty (or set to 1) the default behavior of |'fillchars'|
96
-" `stl`/`stlnc` (`=`/`^`) will be used regardless of its setting. Other good
97
-" choices for |'listchars'| `tab` is: `→ `, `――>`, `├──`, `──┤`, `├─┤`.
111
+" `stl:`/`stlnc:` (`=`/`^`) will be used regardless of its setting. Other good
112
+" choices for |'listchars'| `fold:` is ` ` and `tab:` is: `→ `, `――>`, `├──`,
113
+" `──┤`, `├─┤`.
98 114
 set list
99 115
 set linebreak
100 116
 set breakindent
... ...
@@ -107,7 +123,7 @@ set showbreak=»\ |
107 123
 if has('gui_running')
108 124
   set t_Co=16777216
109 125
 endif
110
-if &t_Co > 16
126
+if 16 <= &t_Co && &t_Co <= 256
111 127
   set t_Co=16
112 128
 endif
113 129
 
... ...
@@ -160,14 +176,20 @@ set textwidth=79
160 176
 set autoindent
161 177
 set nojoinspaces
162 178
 set formatoptions-=t
163
-set formatoptions-=r
164
-set formatoptions+=j
179
+set formatoptions+=q
165 180
 set formatoptions+=n
181
+set formatoptions+=j
166 182
 set nowrap
167 183
 
184
+""" Comments
185
+set commentstring=
186
+
168 187
 """ Folds
169 188
 set foldlevelstart=999
170 189
 set foldtext=substitute(getline(v:foldstart),'\\t',repeat('\ ',&ts),'g').'\ '
190
+if has('eval')
191
+  set foldtext=unobtrusive_fold#text()
192
+endif
171 193
 
172 194
 """ Spelling
173 195
 set spell
... ...
@@ -179,9 +201,7 @@ if has('eval')
179 201
 endif
180 202
 
181 203
 """ Views
182
-set viewoptions-=folds
183 204
 set viewoptions-=options
184
-set viewoptions-=curdir
185 205
 set viewoptions+=slash
186 206
 set viewoptions+=unix
187 207
 
... ...
@@ -213,7 +233,7 @@ nnoremap <silent> <Space>ve :edit   $MYVIMRC<CR>
213 233
 nnoremap <silent> <Space>vs :source $MYVIMRC<CR>
214 234
 
215 235
 """ Help
216
-nnoremap <silent> gK  :helpgrep <C-R><C-W><CR>
236
+nnoremap <silent> gK  :helpgrep \<<C-R><C-W>\><CR>
217 237
 xnoremap <silent> gK y:helpgrep <C-R>"<CR>
218 238
 
219 239
 """ Run
... ...
@@ -253,12 +273,7 @@ endif
253 273
 nnoremap <silent> ZZ :quit<CR>
254 274
 nnoremap <silent> ZQ :quit<CR>
255 275
 
256
-"""" Easier access to black hole register with U
257
-" Overrides the built-in "undo all on line". It is weird, counts as a change,
258
-" and nobody uses it anyway.
259
-nnoremap U "_
260
-
261
-""""" Yank to end of line, not entire line
276
+"""" Yank to end of line, not entire line
262 277
 " As suggested in |Y|. Analogous with |D| does `d$` and |C| does `c$`.
263 278
 nnoremap Y y$
264 279
 
... ...
@@ -269,6 +284,7 @@ xnoremap $ $h
269 284
 xnoremap p pgvy
270 285
 
271 286
 """" Visually select last pasted text
287
+" TODO: Make a text object as well?
272 288
 " Analogous with how |gv| visually selects last visually selected text. Default
273 289
 " to always using ordinary Visual mode. Linewise and blockwise with |+eval|
274 290
 " support.
... ...
@@ -285,6 +301,9 @@ xnoremap <Space>s :s/\%V
285 301
 noremap <MouseUp>   <C-E>
286 302
 noremap <MouseDown> <C-Y>
287 303
 
304
+" Toggle folds.
305
+noremap <RightMouse> <LeftMouse>za
306
+
288 307
 """ Command-line
289 308
 " Take already written text into account when searching history.
290 309
 cnoremap <C-P> <Up>
... ...
@@ -331,9 +350,6 @@ endif
331 350
 nmap gQ gqgc
332 351
 nmap gW gwgc
333 352
 
334
-""" Comments
335
-set commentstring=
336
-
337 353
 """ Folds
338 354
 
339 355
 " Focus current fold.
... ...
@@ -375,35 +391,33 @@ if has('eval')
375 391
   endfunction
376 392
 endif
377 393
 
378
-"" Auto command group
394
+"" Auto commands
379 395
 " Make sure to not define any |autocmd|s before this!
380 396
 augroup vimrc
381 397
   autocmd!
382 398
 augroup END
383 399
 
384
-"" Auto commands
385
-
386
-""" Open the QuickFix/Location list window automatically.
400
+""" Open the QuickFix/Location list window
387 401
 " See
388 402
 " - https://github.com/tpope/vim-dispatch/issues/145
389 403
 " - https://github.com/tpope/vim-dispatch/issues/254
390 404
 " - https://github.com/tpope/vim-dispatch/issues/310
391
-" autocmd QuickFixCmdPost  *{make,{,vim}grep}* nested botright cwindow
392
-" autocmd QuickFixCmdPost *l{make,{,vim}grep}* nested botright lwindow
405
+" autocmd vimrc QuickFixCmdPost  *{make,{,vim}grep}* nested botright cwindow
406
+" autocmd vimrc QuickFixCmdPost *l{make,{,vim}grep}* nested botright lwindow
393 407
 
394
-""" Highlight searches
408
+""" Highlight all searches
395 409
 " |'incsearch'| only highlights the first match.
396
-autocmd vimrc CmdlineEnter /,\? set hlsearch
397
-autocmd vimrc CmdlineLeave /,\? set nohlsearch
410
+autocmd vimrc CmdlineEnter /,\? let s:hlsearch =  &hlsearch | set hlsearch
411
+autocmd vimrc CmdlineLeave /,\? let  &hlsearch = s:hlsearch
398 412
 
399 413
 """ Save/load view
400 414
 " As suggested in |:loadview|, load auto-saved view when opening buffer. Better
401 415
 " than |last-position-jump|, |restore-cursor|.
402
-autocmd BufWinEnter *
416
+autocmd vimrc BufWinEnter *
403 417
 \ if !empty(expand('<afile>')) && empty(&buftype) |
404 418
 \   loadview |
405 419
 \ endif |
406
-autocmd BufWinLeave *
420
+autocmd vimrc BufWinLeave *
407 421
 \ if !empty(expand('<afile>')) && empty(&buftype) |
408 422
 \   mkview |
409 423
 \ endif |
... ...
@@ -485,46 +499,47 @@ autocmd vimrc VimEnter,ColorScheme,OptionSet *
485 499
 
486 500
 if has('eval')
487 501
 
488
-  "" Package manager
502
+  """ GitAdd
503
+  " https://git.rcrnstn.net/rcrnstn/vim-gitadd
489 504
 
490
-  " Make sure to not enable file type detection (|:syntax|, |:filetype|) until
491
-  " after all calls to `PackAdd` have been issued! See |:packadd|.
492
-  command! -bar -bang -nargs=1 PackAdd call s:PackAdd(<q-bang>, <f-args>)
493
-  function! s:PackAdd(bang, url) abort
505
+  " Make sure to not enable |:syntax| and |:filetype| until all plugins that
506
+  " interact with them have been added! See |:packadd|.
507
+  command! -bar -bang -nargs=+ GitAdd call s:GitAdd(<q-bang>, <f-args>)
508
+  function! s:GitAdd(bang, url, ...) abort
494 509
     let name = split(a:url, '/')[-1]
495
-    let dir = split(&packpath, ',')[0] . '/pack/add/opt/' . name
510
+    let dir = split(&packpath, ',')[0] . '/pack/gitadd/opt/' . name
496 511
     if !isdirectory(dir)
497
-      silent execute '!git clone --recurse-submodules' a:url dir
512
+      silent execute '!git clone --recurse-submodules' join(a:000) a:url dir
498 513
       if isdirectory(dir . '/doc')
499 514
         execute 'helptags' dir . '/doc'
500 515
       endif
501 516
     endif
502 517
     if empty(a:bang)
503
-      execute 'packadd!' . name
518
+      execute 'packadd!' name
504 519
     endif
505 520
   endfunction
506 521
 
507
-  "" File type
522
+  """ File type
508 523
 
509
-  """ Built-in `vim`
524
+  """" Built-in `vim`
510 525
 
511 526
   " See |ft-vim-indent|.
512 527
   let g:vim_indent_cont = 0
513 528
 
514
-  """ Built-in `sh`
529
+  """" Built-in `sh`
515 530
 
516 531
   " See |ft-sh-syntax|.
517 532
   let g:is_posix = 1
518 533
 
519
-  """ Built-in `man`
534
+  """" Built-in `man`
520 535
 
521 536
   " See |ft-man-plugin|.
522 537
   let g:ft_man_folding_enable = 1
523 538
   runtime ftplugin/man.vim
524
-  set keywordprg=:Man
539
+  setglobal keywordprg=:Man
525 540
 
526
-  """ `sheerun/vim-polyglot`
527
-  PackAdd https://github.com/sheerun/vim-polyglot
541
+  """" `sheerun/vim-polyglot`
542
+  GitAdd https://github.com/sheerun/vim-polyglot
528 543
 
529 544
   let g:vim_markdown_no_default_key_mappings = 1
530 545
 
... ...
@@ -533,20 +548,20 @@ if has('eval')
533 548
   \   'autoindent',
534 549
   \ ]
535 550
 
536
-  """ `tpope/vim-sleuth`
537
-  PackAdd https://github.com/tpope/vim-sleuth
551
+  """" `tpope/vim-sleuth`
552
+  GitAdd https://github.com/tpope/vim-sleuth
538 553
 
539
-  """ `tpope/vim-apathy`
540
-  PackAdd https://github.com/tpope/vim-apathy
554
+  """" `tpope/vim-apathy`
555
+  GitAdd https://github.com/tpope/vim-apathy
541 556
 
542
-  """ `tpope/vim-scriptease`
543
-  PackAdd https://github.com/tpope/vim-scriptease
557
+  """" `tpope/vim-scriptease`
558
+  GitAdd https://github.com/tpope/vim-scriptease
544 559
 
545
-  """ `jyscao/vim-greprtpscr`
546
-  PackAdd https://github.com/jyscao/vim-greprtpscr
560
+  """" `jyscao/vim-greprtpscr`
561
+  GitAdd https://github.com/jyscao/vim-greprtpscr
547 562
 
548
-  """ `vimwiki/vimwiki`
549
-  " PackAdd https://github.com/vimwiki/vimwiki
563
+  """" `vimwiki/vimwiki`
564
+  " GitAdd https://github.com/vimwiki/vimwiki
550 565
 
551 566
   " let g:vimwiki_list = [{
552 567
   " \   'path':   '~/notes/',
... ...
@@ -554,23 +569,23 @@ if has('eval')
554 569
   " \   'ext':    '.md',
555 570
   " \ }]
556 571
 
557
-  "" Normal mode
572
+  """ Normal mode
558 573
 
559
-  """ Built-in `matchit`
574
+  """" Built-in `matchit`
560 575
 
561 576
   packadd! matchit
562 577
 
563
-  """ `tpope/vim-unimpaired`
564
-  PackAdd https://github.com/tpope/vim-unimpaired
578
+  """" `tpope/vim-unimpaired`
579
+  GitAdd https://github.com/tpope/vim-unimpaired
565 580
 
566
-  """ `tpope/vim-repeat`
567
-  PackAdd https://github.com/tpope/vim-repeat
581
+  """" `tpope/vim-repeat`
582
+  GitAdd https://github.com/tpope/vim-repeat
568 583
 
569
-  """ `tpope/vim-characterize`
570
-  PackAdd https://github.com/tpope/vim-characterize
584
+  """" `tpope/vim-characterize`
585
+  GitAdd https://github.com/tpope/vim-characterize
571 586
 
572
-  """ `haya14busa/vim-asterisk`
573
-  PackAdd https://github.com/haya14busa/vim-asterisk
587
+  """" `haya14busa/vim-asterisk`
588
+  GitAdd https://github.com/haya14busa/vim-asterisk
574 589
 
575 590
   " As suggested by |asterisk-key-mappings|, except the mappings that don't
576 591
   " move the cursor set |'hlsearch'|.
... ...
@@ -583,11 +598,11 @@ if has('eval')
583 598
   map <silent> zg* <Plug>(asterisk-gz*):set hlsearch<CR>
584 599
   map <silent> zg# <Plug>(asterisk-gz#):set hlsearch<CR>
585 600
 
586
-  """ `AndrewRadev/splitjoin.vim`
587
-  PackAdd https://github.com/AndrewRadev/splitjoin.vim
601
+  """" `AndrewRadev/splitjoin.vim`
602
+  GitAdd https://github.com/AndrewRadev/splitjoin.vim
588 603
 
589
-  """ `AndrewRadev/switch.vim`
590
-  PackAdd https://github.com/AndrewRadev/switch.vim
604
+  """" `AndrewRadev/switch.vim`
605
+  GitAdd https://github.com/AndrewRadev/switch.vim
591 606
 
592 607
   let g:switch_custom_definitions = [{
593 608
   \   '\<0\>': '1',
... ...
@@ -600,66 +615,71 @@ if has('eval')
600 615
   \   '\(\w*\)false\(\w*\)': '\1true\2',
601 616
   \ }]
602 617
 
603
-  "" Insert mode
618
+  """ Insert mode
604 619
 
605
-  """ `tpope/vim-endwise`
606
-  PackAdd https://github.com/tpope/vim-endwise
620
+  """" `tpope/vim-endwise`
621
+  GitAdd https://github.com/tpope/vim-endwise
607 622
 
608
-  """ `jiangmiao/auto-pairs`
609
-  PackAdd https://github.com/jiangmiao/auto-pairs
623
+  """" `jiangmiao/auto-pairs`
624
+  GitAdd https://github.com/jiangmiao/auto-pairs
610 625
 
611 626
   " Don't jump around too much. See |autopairs-options|.
612 627
   let g:AutoPairsCenterLine = 0
613 628
   let g:AutoPairsMultilineClose = 0
614 629
 
615
-  "" Command-line mode
630
+  """ Command-line mode
616 631
 
617
-  """ `tpope/vim-rsi`
618
-  PackAdd https://github.com/tpope/vim-rsi
632
+  """" `tpope/vim-rsi`
633
+  GitAdd https://github.com/tpope/vim-rsi
619 634
 
620
-  """ `tpope/vim-abolish`
621
-  PackAdd https://github.com/tpope/vim-abolish
635
+  """" `tpope/vim-abolish`
636
+  GitAdd https://github.com/tpope/vim-abolish
622 637
 
623
-  "" Operators
638
+  """ Operators
624 639
 
625
-  """ `tpope/vim-surround`
626
-  PackAdd https://github.com/tpope/vim-surround
640
+  """" `tpope/vim-surround`
641
+  GitAdd https://github.com/tpope/vim-surround
627 642
 
628
-  """ `tpope/vim-commentary`
629
-  PackAdd https://github.com/tpope/vim-commentary
643
+  """" `tpope/vim-commentary`
644
+  GitAdd https://github.com/tpope/vim-commentary
630 645
 
631
-  """ `tommcdo/vim-lion`
632
-  PackAdd https://github.com/tommcdo/vim-lion
646
+  """" `tommcdo/vim-lion`
647
+  GitAdd https://github.com/tommcdo/vim-lion
633 648
 
634 649
   let g:lion_squeeze_spaces = 1
635 650
 
636
-  """ `tommcdo/vim-nowchangethat`
637
-  PackAdd https://github.com/tommcdo/vim-nowchangethat
651
+  """" `tommcdo/vim-nowchangethat`
652
+  GitAdd https://github.com/tommcdo/vim-nowchangethat
638 653
 
639
-  "" Motions / text objects
654
+  """ Motions / text objects
655
+  " TODO: Check that none of the later ones are not already defined by
656
+  " `targets.vim`.
640 657
 
641
-  """ `wellle/targets.vim`
642
-  PackAdd https://github.com/wellle/targets.vim
658
+  """" `wellle/targets.vim`
659
+  GitAdd https://github.com/wellle/targets.vim
643 660
 
644
-  """ `bkad/CamelCaseMotion`
645
-  PackAdd https://github.com/bkad/CamelCaseMotion
661
+  """" `bkad/CamelCaseMotion`
662
+  GitAdd https://github.com/bkad/CamelCaseMotion
646 663
 
647 664
   let g:camelcasemotion_key = '<Space>'
648 665
 
649
-  """ `tommcdo/vim-exchange`
650
-  PackAdd https://github.com/tommcdo/vim-exchange
666
+  """" `tommcdo/vim-exchange`
667
+  GitAdd https://github.com/tommcdo/vim-exchange
668
+
669
+  """" `qstrahl/vim-dentures`
670
+  GitAdd https://github.com/qstrahl/vim-dentures
651 671
 
652
-  """ `qstrahl/vim-dentures`
653
-  PackAdd https://github.com/qstrahl/vim-dentures
672
+  """" `kana/vim-textobj-user`
673
+  GitAdd https://github.com/kana/vim-textobj-user
654 674
 
655
-  """ `kana/vim-textobj-user`
656
-  PackAdd https://github.com/kana/vim-textobj-user
675
+  " All later plugins in the "Motions / text objects" category depend on this
676
+  " plugin. See https://github.com/kana/vim-textobj-user/wiki.
657 677
 
658
-  """ `kana/vim-textobj-entire`
659
-  PackAdd https://github.com/kana/vim-textobj-entire
678
+  """" `kana/vim-textobj-entire`
679
+  GitAdd https://github.com/kana/vim-textobj-entire
660 680
 
661
-  """ `kana/vim-textobj-line`
662
-  PackAdd https://github.com/kana/vim-textobj-line
681
+  """" `kana/vim-textobj-line`
682
+  GitAdd https://github.com/kana/vim-textobj-line
663 683
 
664 684
   " As suggested in |textobj-line-default-key-mappings|, except `{a,i}l` is
665 685
   " taken by `targets` "last", so we use uppercase `{a,i}L`.
... ...
@@ -669,19 +689,31 @@ if has('eval')
669 689
   xmap aL <Plug>(textobj-line-a)
670 690
   xmap iL <Plug>(textobj-line-i)
671 691
 
672
-  """ `kana/vim-textobj-fold`
673
-  PackAdd https://github.com/kana/vim-textobj-fold
692
+  """" `kana/vim-textobj-fold`
693
+  GitAdd https://github.com/kana/vim-textobj-fold
694
+
695
+  """" `kana/vim-textobj-syntax`
696
+  GitAdd https://github.com/kana/vim-textobj-syntax
674 697
 
675
-  """ `kana/vim-textobj-syntax`
676
-  PackAdd https://github.com/kana/vim-textobj-syntax
698
+  """" `kana/vim-textobj-function`
699
+  GitAdd https://github.com/kana/vim-textobj-function
677 700
 
678
-  """ `idbrii/textobj-word-column.vim`
679
-  PackAdd https://github.com/idbrii/textobj-word-column.vim
701
+  """" `idbrii/textobj-word-column.vim`
702
+  GitAdd https://github.com/idbrii/textobj-word-column.vim
680 703
 
681
-  "" Colors
704
+  """" `adriaanzon/vim-textobj-matchit`
705
+  GitAdd https://github.com/adriaanzon/vim-textobj-matchit
682 706
 
683
-  """ `gruvbox-community/gruvbox`
684
-  PackAdd https://github.com/gruvbox-community/gruvbox
707
+  """" `rhysd/vim-textobj-continuous-line`
708
+  GitAdd https://github.com/rhysd/vim-textobj-continuous-line
709
+
710
+  """" `rsrchboy/vim-textobj-heredocs`
711
+  GitAdd https://github.com/rsrchboy/vim-textobj-heredocs
712
+
713
+  """ Colors
714
+
715
+  """" `gruvbox-community/gruvbox`
716
+  GitAdd https://github.com/gruvbox-community/gruvbox
685 717
 
686 718
   let g:gruvbox_contrast_dark = 'hard'
687 719
   let g:gruvbox_invert_selection = 0
... ...
@@ -693,68 +725,95 @@ if has('eval')
693 725
     colorscheme gruvbox
694 726
   endif
695 727
 
696
-  "" Windows
728
+  """ Windows
697 729
 
698
-  """ `moll/vim-bbye`
699
-  PackAdd https://github.com/moll/vim-bbye
730
+  """" `moll/vim-bbye`
731
+  GitAdd https://github.com/moll/vim-bbye
700 732
 
701
-  "" Folds
733
+  """ Folds
702 734
 
703
-  """ `rcrnstn/vim-unobtrusive-fold`
704
-  PackAdd https://git.rcrnstn.net/rcrnstn/vim-unobtrusive-fold
735
+  """" `rcrnstn/vim-unobtrusive-fold`
736
+  GitAdd https://git.rcrnstn.net/rcrnstn/vim-unobtrusive-fold
705 737
 
706
-  "" Undo
738
+  """ Undo
707 739
 
708
-  """ `mbbill/undotree`
709
-  PackAdd https://github.com/mbbill/undotree
740
+  """" `mbbill/undotree`
741
+  GitAdd https://github.com/mbbill/undotree
710 742
 
711
-  "" QuickFix
743
+  nnoremap <silent> <Space>u :UndotreeToggle<CR>
712 744
 
713
-  """ Built-in `cfilter`
745
+  " let g:undotree_HighlightChangedText = 0
746
+  " let g:undotree_DiffCommand = 'diff -u'
747
+
748
+  """ QuickFix
749
+
750
+  """" Built-in `cfilter`
714 751
 
715 752
   packadd! cfilter
716 753
 
717
-  "" Modelines
754
+  """ Modelines
755
+
756
+  """" `ypcrts/securemodelines`
757
+  GitAdd https://github.com/ypcrts/securemodelines
718 758
 
719
-  """ `ypcrts/securemodelines`
720
-  PackAdd https://github.com/ypcrts/securemodelines
759
+  """ Environment interaction
721 760
 
722
-  "" Operating system interaction
761
+  """" Built-in `netrw`
723 762
 
724
-  """ `ctrlpvim/ctrlp.vim`
725
-  PackAdd https://github.com/ctrlpvim/ctrlp.vim
763
+  " Netrw versions (roughly) 162h to 170 break `gx`. Never download the remote
764
+  " file to a temporary. See
765
+  " - https://github.com/vim/vim/issues/1386
766
+  " - https://github.com/vim/vim/issues/4738
767
+  " - https://github.com/vim/vim/pull/7188
768
+  let g:netrw_nogx = 1
769
+  nnoremap <silent> gx  :call netrw#BrowseX(netrw#GX(), 0)<CR>
770
+  xnoremap <silent> gx y:call netrw#BrowseX(@",         0)<CR>
771
+
772
+  """" `ctrlpvim/ctrlp.vim`
773
+  GitAdd https://github.com/ctrlpvim/ctrlp.vim
726 774
 
727 775
   let g:ctrlp_working_path_mode = ''
728 776
   let g:ctrlp_match_current_file = 1
729
-  let g:ctrlp_follow_symlinks = 1
777
+  let g:ctrlp_follow_symlinks = 2
730 778
   let g:ctrlp_show_hidden = 1
731 779
   let g:ctrlp_status_func = ''
732 780
   let g:ctrlp_line_prefix = ''
733 781
   let g:ctrlp_use_caching = 0
734
-  let g:ctrlp_max_files = 10000 " Default 10000.
782
+  let g:ctrlp_use_readdir = 0 " Respect 'wildignore'.
783
+  let g:ctrlp_max_files = 0 " Default 10000.
735 784
   let g:ctrlp_max_depth = 40 " Default 40.
785
+  " let g:ctrlp_user_command_async = 1
736 786
   if has('unix')
737
-    let g:ctrlp_user_command = 'find -L %s' .
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)')) .
742
-    \ ' \) -prune' .
743
-    \ ' -o -type f -exec grep -Il . {} +' .
744
-    \ ' 2> /dev/null' .
745
-    \ ' | head -n ' . g:ctrlp_max_files
787
+    " TODO: Set `grepprg` to something similar, that skips things in
788
+    " 'wildignore'.
789
+    " let g:ctrlp_user_command = 'find' .
790
+    " \ (g:ctrlp_follow_symlinks ? ' -L' : '') .
791
+    " \ ' %s' .
792
+    " \ ' -maxdepth ' . g:ctrlp_max_depth .
793
+    " \ ' \( -false' .
794
+    " \ (g:ctrlp_show_hidden ? '' : ' -o -name ".*"') .
795
+    " \ ' ' .
796
+    " \ join(map(split(&wildignore, ','), '"-o -name " . shellescape(v:val)')) .
797
+    " \ ' \) -prune -o' .
798
+    " \ ' -type f' .
799
+    " \ ' -exec grep -Il . {} +' .
800
+    " \ ' 2> /dev/null' .
801
+    " \ (g:ctrlp_max_files ? ' | head -n ' . g:ctrlp_max_files : '')
802
+    " " \ ' \(' .
803
+    " " \ (g:ctrlp_follow_symlinks == 2 ? ' -o -type l' : '') .
804
+    " " \ ' \)' .
746 805
   endif
747 806
 
748
-  """ `tpope/vim-fugitive`
749
-  PackAdd https://github.com/tpope/vim-fugitive
807
+  """" `tpope/vim-fugitive`
808
+  GitAdd https://github.com/tpope/vim-fugitive
750 809
 
751 810
   autocmd vimrc FileType fugitiveblame call fugitive#MapJumps()
752 811
 
753
-  """ `tommcdo/vim-fugitive-blame-ext`
754
-  PackAdd https://github.com/tommcdo/vim-fugitive-blame-ext
812
+  """" `tommcdo/vim-fugitive-blame-ext`
813
+  GitAdd https://github.com/tommcdo/vim-fugitive-blame-ext
755 814
 
756
-  """ `tpope/vim-dispatch`
757
-  PackAdd https://github.com/tpope/vim-dispatch
815
+  """" `tpope/vim-dispatch`
816
+  GitAdd https://github.com/tpope/vim-dispatch
758 817
 
759 818
   nnoremap <Space>m% :Make %:r:S<CR>
760 819
   nnoremap <Space>m# :Make #:r:S<CR>
... ...
@@ -762,29 +821,29 @@ if has('eval')
762 821
   nnoremap <Space>ma :Make all<CR>
763 822
   nnoremap <Space>mt :Make test<CR>
764 823
 
765
-  """ `tpope/vim-eunuch`
766
-  PackAdd https://github.com/tpope/vim-eunuch
824
+  """" `tpope/vim-eunuch`
825
+  GitAdd https://github.com/tpope/vim-eunuch
767 826
 
768
-  """ `tpope/vim-projectionist`
769
-  PackAdd https://github.com/tpope/vim-projectionist
827
+  """" `tpope/vim-projectionist`
828
+  GitAdd https://github.com/tpope/vim-projectionist
770 829
 
771
-  "" Debugging
830
+  """ Debugging
772 831
 
773
-  """ `puremourning/vimspector`
774
-  " PackAdd https://github.com/puremourning/vimspector
832
+  """" `puremourning/vimspector`
833
+  " GitAdd https://github.com/puremourning/vimspector
775 834
 
776 835
   " Debug Adapter Protocol (DAP) client. See
777 836
   " https://microsoft.github.io/debug-adapter-protocol/.
778 837
 
779
-  """ `vim-vdebug/vdebug`
780
-  " PackAdd https://github.com/vim-vdebug/vdebug
838
+  """" `vim-vdebug/vdebug`
839
+  " GitAdd https://github.com/vim-vdebug/vdebug
781 840
 
782 841
   " Common DeBugGer Protocol (DBGP) client. See
783 842
   " https://en.wikipedia.org/wiki/DBGp.
784 843
 
785 844
 endif " has('eval')
786 845
 
787
-"" Syntax
846
+"" Syntax and file type
788 847
 if has('eval')
789 848
   syntax enable
790 849
   filetype plugin indent on
... ...
@@ -792,21 +851,8 @@ endif
792 851
 
793 852
 "" File type overrides
794 853
 
795
-" As suggested in |ft-syntax-omni|, use syntax completion if no other
796
-" completion has been defined.
797
-autocmd vimrc FileType *
798
-\ if &omnifunc == '' |
799
-\   setlocal omnifunc=syntaxcomplete#Complete |
800
-\ endif |
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
-
808 854
 autocmd vimrc FileType vim
809
-\ setlocal formatoptions-=r
855
+\ setlocal keywordprg=:help formatoptions-=r
810 856
 
811 857
 autocmd vimrc FileType help
812 858
 \ setlocal nolist
... ...
@@ -817,6 +863,17 @@ autocmd vimrc FileType man
817 863
 autocmd vimrc FileType c,cpp
818 864
 \ setlocal commentstring=//\ %s
819 865
 
866
+" As suggested in |ft-syntax-omni|, use syntax completion if no other
867
+" completion has been defined.
868
+autocmd vimrc FileType *
869
+\ if &omnifunc == '' |
870
+\   setlocal omnifunc=syntaxcomplete#Complete |
871
+\ endif |
872
+
873
+" As suggested in |unobtrusive-fold-example|.
874
+autocmd vimrc FileType *        UnobtrusiveFoldComment
875
+autocmd vimrc FileType markdown UnobtrusiveFoldChar #
876
+
820 877
 "" Terminal overrides
821 878
 " See |terminal-options|.
822 879
 
Robert Cranston authored on 14/08/2022 09:41:11
Showing 1 changed files
... ...
@@ -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
 
Browse code

WIP: Add vimrc

Robert Cranston authored on 10/07/2022 13:48:00
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,751 @@
1
+"" My |vimrc|
2
+
3
+" A |'textwidth'| of 79 is used throughout.
4
+
5
+""" Comments
6
+
7
+" Comments are written in Vim's help |notation|, see |help-writing|, which can
8
+" be highlighted with
9
+" https://git.rcrnstn.net/rcrnstn/vim-unobtrusive-vimcomments.
10
+
11
+" Section headings are not written in |notation|, but are instead indicated
12
+" with multiple comment characters, which can form folds with
13
+" https://git.rcrnstn.net/rcrnstn/vim-unobtrusive-folds.
14
+
15
+""" Compatibility
16
+
17
+" This vimrc should work with all configurations of Vim. Manually tested with:
18
+" - Features: tiny, huge (Debian `apt-get install vim-{tiny,gtk3}`)
19
+" - Encodings/Locales: C, UTF-8 (`LC_ALL=C{,.UFT-8}`)
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
22
+"   for the outer terminal
23
+" - Platforms: Linux
24
+
25
+""" Features
26
+
27
+" |:version| says "tiny" features are always present and are therefore used in
28
+" favor of more advanced features whenever possible. These include:
29
+" - |+multi_byte|
30
+" - |+mouse|
31
+" - |+tag_binary|
32
+" - |+user_commands|
33
+" - |+autocmd|
34
+" - |+localmap|
35
+" Important features that are only present in "normal":
36
+" - |+eval|
37
+
38
+" |<Leader>| is hard-coded to <Space> so that mappings work without |+eval|.
39
+
40
+" Note that trying to set unsupported options is silently ignored, and so can
41
+" be done without checking for support first (which is good, since that
42
+" requires |+eval|). Everything between |:if| and |:endif| is also silently
43
+" ignored if |+eval| is not available.
44
+
45
+""" Encoding
46
+
47
+" |'encoding'| is hard-coded to `utf-8`. However, only characters present in
48
+" Code Page 437 should be used in the interface, to ensure font support on most
49
+" terminals (in particular, the Linux console). See
50
+" - https://en.wikipedia.org/wiki/Code_page_347
51
+" - https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/tty/vt/cp437.uni
52
+" - `man showconsolefont`
53
+
54
+""" Auto commands
55
+
56
+" At the time of writing, |augroup| messes up the highlighting of |autocmd|s
57
+" within it, so the `vimrc` group name is added to every |autocmd| instead (the
58
+" addition of the group of course makes the highlighting misinterpret it as the
59
+" `vimAutoEventList` and the events instead get the erroneous
60
+" `VimAutoCmdSfxList`... file a bug?). Don't forget!
61
+
62
+"" Options
63
+
64
+""" Reset
65
+" set all&
66
+
67
+""" Encoding
68
+" Force Vim's internal encoding to a Unicode encoding.
69
+set encoding=utf-8
70
+
71
+""" Buffers
72
+" Allow switching away from unsaved buffers.
73
+set hidden
74
+
75
+""" Clipboard
76
+" Integrate with any graphical environment's clipboard.
77
+set clipboard^=unnamedplus
78
+
79
+""" Editing
80
+set backspace=indent,eol,start
81
+set virtualedit=block
82
+
83
+""" Windows
84
+" Put newly opened windows below and to the right.
85
+set splitbelow
86
+set splitright
87
+
88
+""" Interface clutter
89
+set noruler
90
+set showcmd
91
+set shortmess+=I
92
+set guioptions=cf
93
+
94
+""" Interface characters
95
+" If |'t_Co'| is empty (or set to 1) the default behavior of |'fillchars'|
96
+" `stl`/`stlnc` (`=`/`^`) will be used regardless of its setting. Other good
97
+" choices for |'listchars'| `tab` is: `→ `, `――>`, `├──`, `──┤`, `├─┤`.
98
+set list
99
+set linebreak
100
+set breakindent
101
+set breakindentopt=sbr,shift:2
102
+set fillchars=stl:_,stlnc:_,vert:│,fold:─,diff:\ |
103
+set listchars=tab:├\ ┤,trail:•,extends:›,precedes:‹,nbsp:·
104
+set showbreak=»\ |
105
+
106
+""" Colors
107
+if has('gui_running')
108
+  set t_Co=16777216
109
+endif
110
+if &t_Co > 16
111
+  set t_Co=16
112
+endif
113
+
114
+""" Title
115
+set title
116
+set titlestring=vim:%{fnamemodify(getcwd(),':~:t:s?^$?/?')}%(:%<%{pathshorten(expand('%:~:.'))}%)
117
+
118
+""" Tabs
119
+set expandtab
120
+set shiftround
121
+set shiftwidth=4
122
+set softtabstop=-1
123
+
124
+""" Mouse
125
+set mouse=a
126
+
127
+""" Command-line
128
+set wildmenu
129
+set wildmode=longest:full,full
130
+set wildignore=.git,_*,node_modules
131
+
132
+""" Search
133
+set incsearch
134
+set shortmess-=S
135
+
136
+""" Timing
137
+set lazyredraw
138
+set notimeout
139
+set ttimeout
140
+set ttimeoutlen=100
141
+
142
+""" Diffs
143
+set diffopt+=vertical
144
+set diffopt+=foldcolumn:0
145
+
146
+""" Formatting
147
+" See |auto-format|, |format-comments|, and |fo-table|.
148
+set textwidth=79
149
+" set colorcolumn=+1
150
+set autoindent
151
+set nojoinspaces
152
+set formatoptions-=t
153
+set formatoptions-=r
154
+set formatoptions+=j
155
+set formatoptions+=n
156
+set nowrap
157
+
158
+""" Folds
159
+set foldlevelstart=999
160
+set foldtext=substitute(getline(v:foldstart),'\\t',repeat('\ ',&ts),'g').'\ '
161
+
162
+""" Spelling
163
+set spell
164
+set spelllang=en_us " May my ancestors forgive me.
165
+if has('eval')
166
+  " Files downloaded from URL documented in |'thesaurus'|:
167
+  " https://github.com/vim/vim/issues/629#issuecomment-443293282.
168
+  let &thesaurus = split(&runtimepath, ',')[0] . '/thesaurus/en_us.txt'
169
+endif
170
+
171
+""" Views
172
+set viewoptions-=folds
173
+set viewoptions-=options
174
+set viewoptions-=curdir
175
+set viewoptions+=slash
176
+set viewoptions+=unix
177
+
178
+"" Mappings
179
+
180
+""" Escape
181
+" Overwrites the default |i_CTRL-C|, |v_CTRL-C|. See
182
+" https://vim.fandom.com/wiki/Avoid_the_escape_key.
183
+inoremap <C-C> <Esc>
184
+xnoremap <C-C> <Esc>
185
+
186
+""" Windows
187
+nnoremap <C-H> <C-W>h
188
+nnoremap <C-J> <C-W>j
189
+nnoremap <C-K> <C-W>k
190
+nnoremap <C-L> <C-W>l
191
+tnoremap <C-H> <C-W>h
192
+tnoremap <C-J> <C-W>j
193
+tnoremap <C-K> <C-W>k
194
+tnoremap <C-L> <C-W>l
195
+
196
+""" `$MYVIMRC`
197
+nnoremap <silent> <Space>ve :edit   $MYVIMRC<CR>
198
+nnoremap <silent> <Space>vs :source $MYVIMRC<CR>
199
+
200
+""" Run command
201
+nnoremap <Space>! :new \| .!
202
+
203
+""" Run file
204
+nnoremap <silent> <Space>% :!%:p:S<CR>
205
+nnoremap <silent> <Space># :!#:p:S<CR>
206
+
207
+""" Run `diff`
208
+nnoremap <silent> <Space>d :w !diff --color -u %:S -<CR>
209
+
210
+""" Run `make`
211
+" TODO: |dispatch| provides default mappings, try to emulate them?
212
+nnoremap <Space>m% :!make %:r:S<CR>
213
+nnoremap <Space>m# :!make #:r:S<CR>
214
+nnoremap <Space>mm :!make<CR>
215
+nnoremap <Space>ma :!make all<CR>
216
+nnoremap <Space>mt :!make test<CR>
217
+nnoremap <Space>md :!make debug<CR>
218
+if has('quickfix')
219
+  nnoremap <Space>m% :silent make! %:r:S \| redraw!<CR>
220
+  nnoremap <Space>m# :silent make! #:r:S \| redraw!<CR>
221
+  nnoremap <Space>mm :silent make!       \| redraw!<CR>
222
+  nnoremap <Space>ma :silent make! all   \| redraw!<CR>
223
+  nnoremap <Space>mt :silent make! test  \| redraw!<CR>
224
+endif
225
+if has('terminal')
226
+  nnoremap <Space>md :terminal make debug<CR>
227
+endif
228
+
229
+""" Improve default mappings
230
+
231
+"""" Disable unconditional quit from Normal mode
232
+" As warned about in |zz| these may be typed accidentally when Caps Lock is
233
+" enabled and lose data. Redefining them is a bit hostile towards other users,
234
+" but deemed worth it.
235
+nnoremap <silent> ZZ :quit<CR>
236
+nnoremap <silent> ZQ :quit<CR>
237
+
238
+"""" 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.
241
+nnoremap U "_
242
+
243
+""""" Yank to end of line, not entire line
244
+" As suggested in |Y|. This is analogous with |D| does `d$` and |C| does `c$`.
245
+nnoremap Y y$
246
+
247
+"""" Don't include newline in Visual mode `$`.
248
+xnoremap $ $h
249
+
250
+"""" Visual mode paste doesn't clobber unnamed register
251
+xnoremap p pgvy
252
+
253
+"""" 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.
257
+nnoremap gp `[v`]
258
+if has('eval')
259
+  nnoremap <expr> gp '`[' . getregtype()[0] . '`]'
260
+endif
261
+
262
+"""" Restrict Visual mode substitutions to the selected text
263
+xnoremap <Space>s :s/\%V
264
+
265
+""" Mouse
266
+" As suggested in |scroll-mouse-wheel|, scroll only one line.
267
+noremap <MouseUp>   <C-E>
268
+noremap <MouseDown> <C-Y>
269
+
270
+""" Command-line
271
+" Take already written text into account when searching history.
272
+cnoremap <C-P> <Up>
273
+cnoremap <C-N> <Down>
274
+
275
+""" Macros
276
+
277
+" Repeat the macro in register `q` on current line, lines covered by visual
278
+" selection, or line covered by text object.
279
+nnoremap          QQ @q
280
+xnoremap <silent> Q  :normal! @q<CR>
281
+nnoremap <silent> Q  :set operatorfunc=<SID>Q<CR>g@
282
+if has('eval')
283
+  function! s:Q(...) abort
284
+    '[,']normal! @q
285
+  endfunction
286
+endif
287
+
288
+""" Formatting
289
+
290
+" Format comment (only). NOTE that this requires a `gc` comment text object
291
+" plugin.
292
+nmap gQ gqgc
293
+nmap gW gwgc
294
+
295
+""" Folds
296
+
297
+" Focus current fold.
298
+nnoremap zV zMzv
299
+
300
+" Focus next/previous fold. Overwrites default move to start/end of
301
+" next/previous fold.
302
+nnoremap zj zvm<zjzvm>gvzc'>zv
303
+nnoremap zk zvzcVoVgkzvgkzvzcVoVzv
304
+
305
+" Open/close nested folds recursively. Overwrites default open/close fold under
306
+" cursor recursively.
307
+nnoremap <silent> zO zvzczO
308
+nnoremap <silent> zC zvzcV:foldclose!<CR>zvzc
309
+
310
+""" Spelling
311
+
312
+" Correct last misspelled word with first suggestion without moving the cursor.
313
+" See also |compl-spelling|.
314
+nnoremap z?               [s1z=<C-O>
315
+inoremap <C-L> <C-G>u<Esc>[s1z=`]a<C-G>u
316
+
317
+""" Visual mode operators
318
+
319
+" Allows for visual selection of text objects that share a name with an
320
+" operator.
321
+nnoremap <silent> <Space>v     :set operatorfunc=<SID>v<CR>g@
322
+nnoremap <silent> <Space>V     :set operatorfunc=<SID>V<CR>g@
323
+nnoremap <silent> <Space><C-V> :set operatorfunc=<SID>CV<CR>g@
324
+if has('eval')
325
+  function! s:v(...) abort
326
+    execute 'normal!' '`[v`]'
327
+  endfunction
328
+  function! s:V(...) abort
329
+    execute 'normal!' '`[V`]'
330
+  endfunction
331
+  function! s:CV(...) abort
332
+    execute 'normal!' "`[\<C-V>`]"
333
+  endfunction
334
+endif
335
+
336
+"" Auto command group
337
+" Make sure to not define any |autocmd|s before this!
338
+augroup vimrc
339
+  autocmd!
340
+augroup END
341
+
342
+"" Auto commands
343
+
344
+""" Open the quickfix/location list window automatically.
345
+" See
346
+" - https://github.com/tpope/vim-dispatch/issues/145
347
+" - https://github.com/tpope/vim-dispatch/issues/254
348
+" - https://github.com/tpope/vim-dispatch/issues/310
349
+" autocmd QuickFixCmdPost  *{make,{,vim}grep}* nested botright cwindow
350
+" autocmd QuickFixCmdPost *l{make,{,vim}grep}* nested botright lwindow
351
+
352
+""" Highlight searches
353
+" |'incsearch'| only highlights the first match.
354
+autocmd vimrc CmdlineEnter /,\? set hlsearch
355
+autocmd vimrc CmdlineLeave /,\? set nohlsearch
356
+
357
+""" Save/load view
358
+" As suggested in |:loadview|, load auto-saved view when opening buffer. Better
359
+" than |last-position-jump|, |restore-cursor|.
360
+autocmd BufWinEnter *
361
+\ if !empty(expand('<afile>')) && empty(&buftype) |
362
+\   loadview |
363
+\ endif |
364
+autocmd BufWinLeave *
365
+\ if !empty(expand('<afile>')) && empty(&buftype) |
366
+\   mkview |
367
+\ endif |
368
+
369
+"" Colors
370
+" See |cterm-colors|, |gui-colors|. The greyscale hex values used for the GUI
371
+" are CIELCHuv lightness 20, 60 and 80.
372
+
373
+""" Defaults
374
+" See |:hi-normal|, |:hi-normal-cterm|.
375
+
376
+"""" Dark background and light foreground.
377
+set background=dark
378
+highlight! Normal guibg=#303030 guifg=#c6c6c6 ctermfg=White
379
+
380
+""" Overrides
381
+
382
+"""" Transparency
383
+" Greyscale interface, dark red errors/warnings, light red spelling errors,
384
+" bold white todos.
385
+
386
+if !has('gui_running')
387
+  autocmd vimrc VimEnter,ColorScheme,OptionSet *
388
+  \ highlight! Normal guibg=NONE |
389
+endif
390
+
391
+" TODO: Look at all in |'highlight'|.
392
+autocmd vimrc VimEnter,ColorScheme,OptionSet *
393
+\ highlight! Normal           term=NONE cterm=NONE gui=NONE ctermbg=NONE |
394
+\ highlight! LineNr           term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=Grey     guifg=Grey     |
395
+\ highlight! FoldColumn       term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=Grey     guifg=Grey     |
396
+\ highlight! SignColumn       term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=Grey     guifg=Grey     |
397
+\ highlight! VertSplit        term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=Grey     guifg=Grey     |
398
+\ highlight! StatusLine       term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=White    guifg=White    |
399
+\ highlight! StatusLineNC     term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=Grey     guifg=Grey     |
400
+\ highlight! StatusLineTerm   term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=White    guifg=White    |
401
+\ highlight! StatusLineTermNC term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=Grey     guifg=Grey     |
402
+\ highlight! TabLine          term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=Grey     guifg=Grey     |
403
+\ highlight! TabLineFill      term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=Grey     guifg=Grey     |
404
+\ highlight! TabLineSel       term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=White    guifg=White    |
405
+\ highlight! EndOfBuffer      term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=Black    guifg=Black    |
406
+\ highlight! Error            term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=DarkRed  guifg=Red      |
407
+\ highlight! ErrorMsg         term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=DarkRed  guifg=Red      |
408
+\ highlight! WarningMsg       term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=DarkRed  guifg=Red      |
409
+\ highlight! SpellBad         term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=LightRed guifg=LightRed |
410
+\ highlight! SpellLocal       term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=LightRed guifg=LightRed |
411
+\ highlight! SpellRare        term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=LightRed guifg=LightRed |
412
+\ highlight! SpellCap         term=NONE cterm=NONE gui=NONE ctermbg=NONE guibg=NONE ctermfg=LightRed guifg=LightRed |
413
+\ highlight! Todo             term=bold cterm=bold gui=NONE ctermbg=NONE guibg=NONE ctermfg=White    guifg=White    |
414
+
415
+"""" Comments
416
+autocmd vimrc VimEnter,ColorScheme,OptionSet *
417
+\ highlight! Comment guifg=#919191 ctermfg=Grey
418
+
419
+"""" Diffs
420
+autocmd vimrc VimEnter,ColorScheme,OptionSet *
421
+\ highlight! DiffAdd          term=NONE cterm=NONE gui=NONE ctermfg=Black guifg=Black ctermbg=DarkGreen  guibg=Green  |
422
+\ highlight! DiffDelete       term=NONE cterm=NONE gui=NONE ctermfg=Black guifg=Black ctermbg=DarkRed    guibg=Red    |
423
+\ highlight! DiffChange       term=NONE cterm=NONE gui=NONE ctermfg=Black guifg=Black ctermbg=DarkBlue   guibg=Blue   |
424
+\ highlight! DiffText         term=NONE cterm=NONE gui=NONE ctermfg=Black guifg=Black ctermbg=DarkYellow guibg=Yellow |
425
+\ highlight! diffAdded        term=NONE cterm=NONE gui=NONE ctermbg=NONE  guibg=NONE  ctermfg=DarkGreen  guifg=Green  |
426
+\ highlight! diffRemoved      term=NONE cterm=NONE gui=NONE ctermbg=NONE  guibg=NONE  ctermfg=DarkRed    guifg=Red    |
427
+
428
+"""" Folds
429
+autocmd vimrc VimEnter,ColorScheme,OptionSet *
430
+\ highlight! link Folded Comment |
431
+
432
+"""" |'listchars'|
433
+autocmd vimrc VimEnter,ColorScheme,OptionSet *
434
+\ highlight! link SpecialKey Special |
435
+\ highlight! link NonText    Special |
436
+
437
+"""" Vim comments
438
+autocmd vimrc VimEnter,ColorScheme,OptionSet *
439
+\ highlight! link vimCommentString vimComment |
440
+\ highlight! link vimCommentTitle  vimComment |
441
+
442
+"" Plugins
443
+
444
+if has('eval')
445
+
446
+  "" Package manager
447
+
448
+  " Make sure to not enable file type detection (|:syntax|, |:filetype|) until
449
+  " after all calls to `PackAdd` have been issued! See |:packadd|.
450
+  command! -bar -bang -nargs=1 PackAdd call s:PackAdd(<q-bang>, <f-args>)
451
+  function! s:PackAdd(bang, url) abort
452
+    let name = split(a:url, '/')[-1]
453
+    let dir = split(&packpath, ',')[0] . '/pack/add/opt/' . name
454
+    if !isdirectory(dir)
455
+      silent execute '!git clone --recurse-submodules' a:url dir
456
+      if isdirectory(dir . '/doc')
457
+        execute 'helptags' dir . '/doc'
458
+      endif
459
+    endif
460
+    if empty(a:bang)
461
+      execute 'packadd!' . name
462
+    endif
463
+  endfunction
464
+
465
+  "" File type
466
+
467
+  """ Built-in `vim`
468
+
469
+  let g:vim_indent_cont = 0
470
+
471
+  """ Built-in `man`
472
+
473
+  let g:ft_man_folding_enable = 1
474
+  runtime ftplugin/man.vim
475
+  set keywordprg=:Man
476
+
477
+  """ Built-in `markdown`
478
+
479
+  let g:vim_markdown_no_default_key_mappings = 1
480
+
481
+  """ `sheerun/vim-polyglot`
482
+  PackAdd https://github.com/sheerun/vim-polyglot
483
+
484
+  let g:polyglot_disabled = [
485
+  \   'sensible',
486
+  \   'autoindent',
487
+  \ ]
488
+
489
+  """ `tpope/vim-sleuth`
490
+  PackAdd https://github.com/tpope/vim-sleuth
491
+
492
+  """ `tpope/vim-apathy`
493
+  PackAdd https://github.com/tpope/vim-apathy
494
+
495
+  """ `tpope/vim-scriptease`
496
+  PackAdd https://github.com/tpope/vim-scriptease
497
+
498
+  """ `vimwiki/vimwiki`
499
+  " PackAdd https://github.com/vimwiki/vimwiki
500
+
501
+  " let g:vimwiki_list = [{
502
+  " \   'path':   '~/notes/',
503
+  " \   'syntax': 'markdown',
504
+  " \   'ext':    '.md',
505
+  " \ }]
506
+
507
+  "" Normal mode
508
+
509
+  """ Built-in `matchit`
510
+
511
+  packadd! matchit
512
+
513
+  """ `tpope/vim-unimpaired`
514
+  PackAdd https://github.com/tpope/vim-unimpaired
515
+
516
+  """ `tpope/vim-repeat`
517
+  PackAdd https://github.com/tpope/vim-repeat
518
+
519
+  """ `tpope/vim-characterize`
520
+  PackAdd https://github.com/tpope/vim-characterize
521
+
522
+  """ `haya14busa/vim-asterisk`
523
+  PackAdd https://github.com/haya14busa/vim-asterisk
524
+
525
+  " As suggested by |asterisk-key-mappings|, except the mappings that don't
526
+  " move the cursor set |'hlsearch'|.
527
+  map            * <Plug>(asterisk-*)
528
+  map            # <Plug>(asterisk-#)
529
+  map           g* <Plug>(asterisk-g*)
530
+  map           g# <Plug>(asterisk-g#)
531
+  map <silent>  z* <Plug>(asterisk-z*): set hlsearch<CR>
532
+  map <silent>  z# <Plug>(asterisk-z#): set hlsearch<CR>
533
+  map <silent> zg* <Plug>(asterisk-gz*):set hlsearch<CR>
534
+  map <silent> zg# <Plug>(asterisk-gz#):set hlsearch<CR>
535
+
536
+  "" Insert mode
537
+
538
+  """ `tpope/vim-endwise`
539
+  PackAdd https://github.com/tpope/vim-endwise
540
+
541
+  "" Command-line mode
542
+
543
+  """ `tpope/vim-rsi`
544
+  PackAdd https://github.com/tpope/vim-rsi
545
+
546
+  """ `tpope/vim-abolish`
547
+  PackAdd https://github.com/tpope/vim-abolish
548
+
549
+  "" Operators
550
+
551
+  """ `tpope/vim-surround`
552
+  PackAdd https://github.com/tpope/vim-surround
553
+
554
+  """ `tpope/vim-commentary`
555
+  PackAdd https://github.com/tpope/vim-commentary
556
+
557
+  """ `tommcdo/vim-lion`
558
+  PackAdd https://github.com/tommcdo/vim-lion
559
+
560
+  "" Motions / text objects
561
+
562
+  """ `wellle/targets.vim`
563
+  PackAdd https://github.com/wellle/targets.vim
564
+
565
+  """ `qstrahl/vim-dentures`
566
+  PackAdd https://github.com/qstrahl/vim-dentures
567
+
568
+  """ `kana/vim-textobj-user`
569
+  PackAdd https://github.com/kana/vim-textobj-user
570
+
571
+  """ `kana/vim-textobj-line`
572
+  PackAdd https://github.com/kana/vim-textobj-line
573
+
574
+  """ `kana/vim-textobj-fold`
575
+  PackAdd https://github.com/kana/vim-textobj-fold
576
+
577
+  """ `idbrii/textobj-word-column.vim`
578
+  PackAdd https://github.com/idbrii/textobj-word-column.vim
579
+
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
+  "" Colors
589
+
590
+  """ `gruvbox-community/gruvbox`
591
+  PackAdd https://github.com/gruvbox-community/gruvbox
592
+
593
+  let g:gruvbox_contrast_dark = 'hard'
594
+  let g:gruvbox_invert_selection = 0
595
+
596
+  " Earlier settings indicate whether we want a color scheme not based on
597
+  " terminal colors. '|termguicolors|' is reset further down if not supported.
598
+  if &t_Co >= 256
599
+    set termguicolors
600
+    colorscheme gruvbox
601
+  endif
602
+
603
+  "" Windows
604
+
605
+  """ `moll/vim-bbye`
606
+  PackAdd https://github.com/moll/vim-bbye
607
+
608
+  "" Folds
609
+
610
+  """ `rcrnstn/vim-unobtrusive-foldexpr`
611
+  PackAdd https://git.rcrnstn.net/rcrnstn/vim-foldexpr-unobtrusive
612
+
613
+  " autocmd vimrc VimEnter *        set commentstring=
614
+  " autocmd vimrc FileType *        call foldexpr_unobtrusive#commentstring(&commentstring)
615
+  " autocmd vimrc FileType markdown call foldexpr_unobtrusive#char('#')
616
+
617
+  "" QuickFix
618
+
619
+  """ Built-in `cfilter`
620
+
621
+  packadd! cfilter
622
+
623
+  "" Operating system interaction
624
+
625
+  """ `ctrlpvim/ctrlp.vim`
626
+  PackAdd https://github.com/ctrlpvim/ctrlp.vim
627
+
628
+  let g:ctrlp_use_caching = 0
629
+  let g:ctrlp_working_path_mode = 'a'
630
+  let g:ctrlp_follow_symlinks = 1
631
+  let g:ctrlp_status_func = ''
632
+  let g:ctrlp_line_prefix = ''
633
+  if has('unix')
634
+    let g:ctrlp_user_command = 'find -L %s' .
635
+    \ ' \( -false' .
636
+    \ join(map(split(&wildignore, ','), '" -o -name " . shellescape(v:val)')) .
637
+    \ ' \) -prune' .
638
+    \ ' -o -type f -exec grep -Il . {} +'
639
+  endif
640
+
641
+  """ `tpope/vim-fugitive`
642
+  PackAdd https://github.com/tpope/vim-fugitive
643
+
644
+  """ `tpope/vim-dispatch`
645
+  PackAdd https://github.com/tpope/vim-dispatch
646
+
647
+  nnoremap <Space>m% :Make %:r:S<CR>
648
+  nnoremap <Space>m# :Make #:r:S<CR>
649
+  nnoremap <Space>mm :Make<CR>
650
+  nnoremap <Space>ma :Make all<CR>
651
+  nnoremap <Space>mt :Make test<CR>
652
+
653
+  """ `tpope/vim-eunuch`
654
+  PackAdd https://github.com/tpope/vim-eunuch
655
+
656
+  "" Debugging
657
+
658
+  """ `puremourning/vimspector`
659
+  " PackAdd https://github.com/puremourning/vimspector
660
+
661
+  " Debug Adapter Protocol (DAP) client. See
662
+  " https://microsoft.github.io/debug-adapter-protocol/.
663
+
664
+  """ `vim-vdebug/vdebug`
665
+  " PackAdd https://github.com/vim-vdebug/vdebug
666
+
667
+  " Common DeBugGer Protocol (DBGP) client. See
668
+  " https://en.wikipedia.org/wiki/DBGp.
669
+
670
+endif " has('eval')
671
+
672
+"" Syntax
673
+if has('eval')
674
+  syntax enable
675
+  filetype plugin indent on
676
+endif
677
+
678
+"" File type overrides
679
+
680
+" As suggested in |ft-syntax-omni|, use syntax completion if no other
681
+" completion has been defined.
682
+autocmd vimrc FileType *
683
+\ if &omnifunc == '' |
684
+\   setlocal omnifunc=syntaxcomplete#Complete |
685
+\ endif |
686
+
687
+autocmd vimrc FileType vim
688
+\ setlocal formatoptions-=r
689
+
690
+autocmd vimrc FileType man
691
+\ setlocal nolist
692
+
693
+autocmd vimrc FileType c,cpp
694
+\ setlocal commentstring=//\ %s
695
+
696
+"" Terminal overrides
697
+" See |terminal-options|.
698
+
699
+""" Cursor
700
+" See |termcap-cursor-shape|, `:helpgrep t_SH`, and "Parameterized Strings" in
701
+" `terminfo(5)`.
702
+
703
+if has('cursorshape')
704
+  set noshowmode
705
+  let &t_vi = ''
706
+  let &t_ve = "\<Esc>[?25h"
707
+  " if $TERM =~? '^xterm\(-\|$\)'
708
+    " See
709
+    " - https://vt100.net/docs/vt510-rm/DECSCUSR
710
+    " - http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
711
+    let &t_EI = "\<Esc>[1 q"
712
+    let &t_SI = "\<Esc>[5 q"
713
+    let &t_SR = "\<Esc>[3 q"
714
+    let &t_SH = "\<Esc>[%p1%d q"
715
+  " endif
716
+  if $TERM =~? '^linux\(-\|$\)'
717
+    " See
718
+    " - https://www.kernel.org/doc/Documentation/admin-guide/vga-softcursor.rst
719
+    let &t_EI = "\<Esc>[?8c"
720
+    let &t_SI = "\<Esc>[?2c"
721
+    let &t_SR = "\<Esc>[?2c"
722
+    let &t_SH = "\<Esc>[?%?%p1%{3}%<%t%{8}%e%{2}%;%dc"
723
+  endif
724
+endif
725
+
726
+""" True-color
727
+" See |xterm-true-color|.
728
+
729
+if has('termguicolors')
730
+  " See https://github.com/termstandard/colors#truecolor-detection.
731
+  if empty($COLORTERM) && !has('vcon')
732
+    set notermguicolors
733
+  endif
734
+  " These are the defaults if `$TERM` is `xterm`.
735
+  let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
736
+  let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
737
+  " Terminal window does not have transparent background when 'termguicolors'
738
+  " is used. See http://ftp.vim.org/pub/vim/patches/8.2/8.2.3516.
739
+  if !has('patch-8.2.3516')
740
+    let s:termguicolors = &termguicolors
741
+    autocmd vimrc TerminalOpen,WinEnter *
742
+    \ let s:newtermguicolors =
743
+    \   s:termguicolors &&
744
+    \   empty(filter(range(1, bufnr('$')),
745
+    \     'getbufvar(v:val, "&buftype") ==# "terminal"'
746
+    \   )) |
747
+    \ if s:newtermguicolors != &termguicolors |
748
+    \   execute 'set' (s:newtermguicolors ? '' : 'no') . 'termguicolors' |
749
+    \ endif |
750
+  endif
751
+endif