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