... | ... |
@@ -1,26 +1,62 @@ |
1 | 1 |
"" My |vimrc| |
2 | 2 |
|
3 |
-" A |'textwidth'| of 79 is used throughout. |
|
3 |
+" TODO: Supply chain attacks are getting more common. We should use (mandate?) |
|
4 |
+" commit hashes in `GitAdd`. Also, make sure to use a command format that |
|
5 |
+" ignores tag/branch names (those can be named to look like hashes and are |
|
6 |
+" mutable). |
|
7 |
+ |
|
8 |
+" TODO: Do we want to try to integrate with Debian? There seems to be at least |
|
9 |
+" two ways vim-related files are installed: |
|
10 |
+" - Purely auxilliary files as part of some other package: Files are installed |
|
11 |
+" to `/usr/share/vim/addons` which are referenced by files installed to |
|
12 |
+" `/usr/share/vim/registry`. `vim-addons` from the `vim-addon-manager` can be |
|
13 |
+" used to (presumably) symlink them into a path that is listed in |
|
14 |
+" 'runtimepath'. |
|
15 |
+" - As a standalone `vim-${addon}` package: Files are installed to |
|
16 |
+" `/usr/share/vim-${addon}`, presumably symlinked into a `start` or `opt` |
|
17 |
+" 'packpath' during package installation. |
|
18 |
+" <https://vim-team.pages.debian.net/vim/> and the `dh_vim-addon` man page in |
|
19 |
+" the `dh-vim-addon` package contains some further details. |
|
4 | 20 |
|
5 |
-""" Comments |
|
21 |
+""" Formatting |
|
22 |
+ |
|
23 |
+" A |'textwidth'| of 79 is used throughout. |
|
6 | 24 |
|
7 | 25 |
" 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. |
|
26 |
+" be highlighted with |
|
27 |
+" <https://git.rcrnstn.net/rcrnstn/vim-unobtrusive-comment>. |
|
9 | 28 |
|
10 | 29 |
" Section headings are not written in the help |notation|, but are instead |
11 | 30 |
" indicated with multiple contiguous comment characters. They can form folds |
12 |
-" with https://git.rcrnstn.net/rcrnstn/vim-unobtrusive-fold. |
|
31 |
+" with <https://git.rcrnstn.net/rcrnstn/vim-unobtrusive-fold>. |
|
13 | 32 |
|
14 | 33 |
""" Compatibility |
15 | 34 |
|
35 |
+" TODO: Test with `nvi`, a "bug-for-bug compatible" clone of the original BSD |
|
36 |
+" `vi`. |
|
37 |
+" TODO: Test with `VIM_POSIX=1 "$vim"` (for different `$vim`s?). See |
|
38 |
+" |$VIM_POSIX|. |
|
39 |
+ |
|
16 | 40 |
" This vimrc should work with all configurations of Vim. Manually tested with: |
17 |
-" - Features: tiny, huge (Debian `apt-get install vim-{tiny,gtk3}`) |
|
41 |
+" - Versions: TODO: Whatever some old {Debian,Ubuntu,Fedora} ships. |
|
42 |
+" - Features: small, huge (Debian `apt-get install vim-{tiny,gtk3}`) |
|
18 | 43 |
" - Locales: C, UTF-8 (`LC_ALL=C{,.UFT-8}`) |
19 | 44 |
" - Colors: 1, 2, 8, 16, 256, termguicolors (`--cmd "set {t_Co=$colors,tgc}"`) |
20 | 45 |
" - UI: TUI, GUI (`{,g}vim`) |
21 | 46 |
" - Terminals: GUI, VTE, Linux, tmux with the correct `Ss` `terminal-override` |
22 | 47 |
" - Platforms: Unix-like |
23 | 48 |
|
49 |
+" TODO: `man setfont` says: |
|
50 |
+" > Note: if a font has more than 256 glyphs, only 8 out of 16 colors can be |
|
51 |
+" > used simultaneously. It can make console perception worse (loss of |
|
52 |
+" > intensity and even some colors). |
|
53 |
+" The default font on my system has 512 glyphs (`showconsolefont -v`). |
|
54 |
+ |
|
55 |
+" TODO: `man setfont` says, in section "CONSOLE MAPS": |
|
56 |
+" > Several mappings are involved in the path from user program output to |
|
57 |
+" > console display. |
|
58 |
+" Might be worth reading up on that. If I already did, document. |
|
59 |
+ |
|
24 | 60 |
""" Features |
25 | 61 |
|
26 | 62 |
" |:version| says "tiny" features are always present and are therefore used in |
... | ... |
@@ -35,15 +71,17 @@ |
35 | 71 |
" Note that trying to set (run-time, but not compile-time) unsupported options |
36 | 72 |
" is silently ignored, and so can be done without checking for support first |
37 | 73 |
" (which is good, since that requires |+eval|). Everything between |:if| and |
38 |
-" |:endif| is also silently ignored if |+eval| is not available. |
|
74 |
+" |:endif| is also silently ignored if |+eval| is not available. See |
|
75 |
+" |no-eval-feature|. |
|
39 | 76 |
|
40 | 77 |
""" Encoding |
41 | 78 |
|
42 | 79 |
" |'encoding'| is hard-coded to `utf-8`. However, only characters present in |
43 | 80 |
" Code Page 437 should be used in the interface, to ensure font support on most |
44 |
-" terminals (in particular, the Linux console). See |
|
45 |
-" - https://en.wikipedia.org/wiki/Code_page_437 |
|
46 |
-" - https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/tty/vt/cp437.uni |
|
81 |
+" terminals (in particular, the Linux console, via `CHARMAP` in |
|
82 |
+" `/etc/default/console-setup`). See |
|
83 |
+" - <https://en.wikipedia.org/wiki/Code_page_437> |
|
84 |
+" - <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/tty/vt/cp437.uni> |
|
47 | 85 |
" - `man showconsolefont` |
48 | 86 |
|
49 | 87 |
""" Re-sourcing |
... | ... |
@@ -73,11 +111,22 @@ |
73 | 111 |
" programming anyway. |
74 | 112 |
|
75 | 113 |
"" Options |
114 |
+ |
|
76 | 115 |
" TODO: Use |setglobal| for more things? Note that for options with a non-empty |
77 |
-" default local value, `setglobal` does nothing useful. |
|
116 |
+" default local value, `setglobal` does nothing useful. Worse, for options with |
|
117 |
+" only a (buffer or window) local value, `setglobal` does nothing, literally. |
|
118 |
+" Is that a problem, should we even set local values here? Maybe identifying |
|
119 |
+" them and getting rid of them is a good idea? |
|
120 |
+ |
|
121 |
+" TODO: Maybe source |defaults.vim|? Probably not, but add some documentation? |
|
122 |
+ |
|
123 |
+" TODO: Look at |:options| and maybe follow the same grouping? |
|
124 |
+ |
|
125 |
+" NOTE that |OptionSet| was added in |
|
126 |
+" <http://ftp.vim.org/pub/vim/patches/8.1/8.1.0081> and may not be available. |
|
78 | 127 |
|
79 | 128 |
""" Reset |
80 |
-" set all& |
|
129 |
+setglobal all& |
|
81 | 130 |
|
82 | 131 |
""" Encoding |
83 | 132 |
" Force Vim's internal encoding to a Unicode encoding. |
... | ... |
@@ -95,48 +144,144 @@ set clipboard^=unnamedplus |
95 | 144 |
set backspace=indent,eol,start |
96 | 145 |
set virtualedit=block |
97 | 146 |
|
147 |
+""" Modeline |
|
148 |
+set nomodeline |
|
149 |
+ |
|
150 |
+""" Navigation |
|
151 |
+set nostartofline |
|
152 |
+" <http://ftp.vim.org/pub/vim/patches/9.0/9.0.0640>: Cannot scroll by screen |
|
153 |
+" line if a line wraps. Add the 'smoothscroll' option. |
|
154 |
+if has('patch-9.0.0640') |
|
155 |
+ set smoothscroll |
|
156 |
+endif |
|
157 |
+ |
|
98 | 158 |
""" Windows |
99 | 159 |
" Put newly opened windows below and to the right. |
100 | 160 |
set splitbelow |
101 | 161 |
set splitright |
102 | 162 |
|
103 |
-""" Interface clutter |
|
104 |
-set noruler |
|
163 |
+""" Interface |
|
105 | 164 |
set showcmd |
165 |
+set noruler |
|
166 |
+set laststatus=1 |
|
167 |
+set showtabline=1 |
|
106 | 168 |
set shortmess+=I |
107 |
-set guioptions=cf |
|
169 |
+set guioptions=cf " console dialogs, foreground (no fork()) |
|
170 |
+set numberwidth=1 |
|
108 | 171 |
|
109 | 172 |
""" Interface characters |
110 | 173 |
" If |'t_Co'| is empty (or set to 1) the default behavior of |'fillchars'| |
111 | 174 |
" `stl:`/`stlnc:` (`=`/`^`) will be used regardless of its setting. Other good |
112 | 175 |
" choices for |'listchars'| `fold:` is ` ` and `tab:` is: `→ `, `――>`, `├──`, |
113 | 176 |
" `──┤`, `├─┤`. |
177 |
+" TODO: `:help 'fillchars'` says "for `stl` and `stlnc` only single-byte values |
|
178 |
+" are supported". Test the current (non-ASCII) values against older versions of |
|
179 |
+" Vim. See also <http://ftp.vim.org/pub/vim/patches/8.2/8.2.2569>. |
|
180 |
+" TODO: If Vim cannot tell appart |hl-StatusLine| and |hl-StatusLineNC| (e.g. |
|
181 |
+" because |hl-StatusLine| is a |hl-link|), (ordinary) spaces and `fillchars` |
|
182 |
+" `stl` characters for the statusline of the focused window will be replaced |
|
183 |
+" with `^`. Note that this includes the single character under the `fillchars` |
|
184 |
+" `vert`, which cannot be set with |'statusline'|. |
|
185 |
+set linespace=-1 |
|
114 | 186 |
set list |
115 | 187 |
set linebreak |
116 | 188 |
set breakindent |
117 | 189 |
set breakindentopt=sbr,shift:2 |
118 |
-set fillchars=stl:_,stlnc:_,vert:│,fold:─,diff:\ | |
|
119 |
-set listchars=tab:├\ ┤,trail:•,extends:›,precedes:‹,nbsp:· |
|
120 |
-set showbreak=»\ | |
|
190 |
+set showbreak=» |
|
191 |
+set fillchars=stl:─,stlnc:─,vert:│,fold:─,diff: |
|
192 |
+" set fillchars=stl:_,stlnc:_,vert:│,fold:─,diff: |
|
193 |
+set listchars=tab:├─,trail:•,extends:›,precedes:‹,nbsp:· |
|
194 |
+" <http://ftp.vim.org/pub/vim/patches/8.1/8.1.0759>: Showing two characters for |
|
195 |
+" tab is limited. Allow for a third character for "tab:" in 'listchars'. |
|
196 |
+if has('patch-8.1.0759') |
|
197 |
+ " ab c |
|
198 |
+ " set listchars+=tab:├\ ┤ |
|
199 |
+ set listchars+=tab:│\ │ |
|
200 |
+endif |
|
201 |
+" TODO: `%f` still shows `[No Name]`, is there a way to remove that? |
|
202 |
+set statusline=%(%f\ %) |
|
203 |
+if has('eval') |
|
204 |
+ " TODO: This works poorly with plugins that have windows with their own |
|
205 |
+ " statusbar, e.g. |undotree.txt|. |
|
206 |
+ " set statusline=%(%{expand('%:.s?^/??')}\ %) |
|
207 |
+ " `fillchar_status` function in `src/screen.c:4649` of Vim source. |
|
208 |
+ " TODO: Try to use some other non-standard space? Search for "\<SPACE\>" in |
|
209 |
+ " |digraphs|. |
|
210 |
+ " set fillchars+=stl:\ ,stlnc: |
|
211 |
+ set fillchars+=stl: ,stlnc: |
|
212 |
+ " set fillchars+=stl:┘,stlnc:┘ |
|
213 |
+ " TODO: Standardize on global functions? Or |autoload|s (but that would break |
|
214 |
+ " our "single file" policy)? |
|
215 |
+ " function! s:statusline() abort |
|
216 |
+ function! Statusline() abort |
|
217 |
+ " TODO: Make this expansion relative to the window-local cwd? Also do other |
|
218 |
+ " substitutions, like `$HOME` to `~`, the expanded `$VIMRUMTIME` to the |
|
219 |
+ " string `$VIMRUNTIME`, etc. We used to have `s?^/??`, why? |
|
220 |
+ " TODO: Harmonize with `titlestring`. |
|
221 |
+ let l:title = !empty(&l:buftype) ? &l:buftype : expand('%:~:.') |
|
222 |
+ if &l:buftype =~# 'help\|terminal' |
|
223 |
+ let l:title .= ':' . expand('%:t') |
|
224 |
+ elseif &l:buftype ==# 'quickfix' && exists('w:quickfix_title') |
|
225 |
+ let l:title .= ':' . w:quickfix_title |
|
226 |
+ endif |
|
227 |
+ if !empty(l:title) |
|
228 |
+ let l:title .= ' ' |
|
229 |
+ endif |
|
230 |
+ " NOTE: `matchstr` looks for the _first_ match. |
|
231 |
+ " TODO: This is slow. Cache the `matchstr` result? |
|
232 |
+ let l:fill = matchstr(&fillchars, '\(^\|,\)stl:\zs[^,]*') |
|
233 |
+ let l:pad = winwidth(0) - strwidth(l:title) |
|
234 |
+ return l:title . repeat(l:fill, l:pad) |
|
235 |
+ endfunction |
|
236 |
+ " <http://ftp.vim.org/pub/vim/patches/8.2/8.2.1347>: Cannot easily get the |
|
237 |
+ " script ID. Support expand('<SID>'). |
|
238 |
+ " if has('patch-8.2.1347') |
|
239 |
+ " let &statusline = '%{'.expandcmd('<SID>statusline()').'}' |
|
240 |
+ " else |
|
241 |
+ let &statusline = '%{Statusline()}' |
|
242 |
+ " function! g:Statusline() abort |
|
243 |
+ " return s:statusline() |
|
244 |
+ " endfunction |
|
245 |
+ " endif |
|
246 |
+endif |
|
121 | 247 |
|
122 | 248 |
""" Colors |
249 |
+" May be overritten later by Vim for terminals with |t_RB|. |
|
123 | 250 |
set background=dark |
124 |
-if has('gui_running') |
|
125 |
- set t_Co=16777216 |
|
126 |
-endif |
|
127 |
-if 16 <= &t_Co && &t_Co <= 256 && !&termguicolors |
|
251 |
+set guioptions+=d |
|
252 |
+if &t_Co > 16 |
|
128 | 253 |
set t_Co=16 |
254 |
+ " <https://github.com/neovim/neovim/issues/11974#issuecomment-1658464993> |
|
255 |
+ if has('nvim') |
|
256 |
+ lua ffi = require "ffi" ffi.cdef "int t_colors" ffi.C.t_colors = 16 |
|
257 |
+ endif |
|
258 |
+endif |
|
259 |
+set notermguicolors |
|
260 |
+" <https://github.com/termstandard/colors#truecolor-detection> |
|
261 |
+if empty($COLORTERM) && !has('vcon') |
|
262 |
+ set notermguicolors |
|
129 | 263 |
endif |
264 |
+if has('gui_running') |
|
265 |
+ set termguicolors |
|
266 |
+endif |
|
267 |
+ |
|
268 |
+""" Bell |
|
269 |
+set belloff=error |
|
130 | 270 |
|
131 | 271 |
""" Title |
132 | 272 |
set title |
133 |
-set titlestring=vim:%{fnamemodify(getcwd(),':~:t:s?^$?/?')}%(:%<%{pathshorten(expand('%:~:.'))}%) |
|
273 |
+" set titlestring=vi:%{fnamemodify(getcwd(),':~:t:s?^$?/?')}%(:%<%{pathshorten(expand('%:.:s?^/??'))}%) |
|
274 |
+" TODO: Break out into `Title()` function and harmonize with `statusline`. |
|
275 |
+set titlestring=vi:%{fnamemodify(getcwd(),':~:t:s?^$?/?')}%(:%<%{expand('%:.:s?^/??')}%) |
|
276 |
+set titleold= |
|
134 | 277 |
|
135 | 278 |
""" Tabs |
136 |
-set expandtab |
|
137 |
-set shiftround |
|
279 |
+" When reading files written by others, assume default `tabstop=8`. |
|
280 |
+" When Writing files, use 4 space indents. |
|
138 | 281 |
set shiftwidth=4 |
282 |
+set shiftround |
|
139 | 283 |
set softtabstop=-1 |
284 |
+set expandtab |
|
140 | 285 |
|
141 | 286 |
""" Mouse |
142 | 287 |
set mouse=a |
... | ... |
@@ -144,9 +289,25 @@ set mouse=a |
144 | 289 |
""" Command-line |
145 | 290 |
set wildmenu |
146 | 291 |
set wildmode=longest:full,full |
147 |
-set wildignore=_*,.git,.cache,.vagrant,.ansible,.npm,node_modules,__pycache__,.venv,*.egg-info,pipx,snap |
|
292 |
+" See also |'suffixes'|. |
|
293 |
+set wildignore+=_* |
|
294 |
+set wildignore+=.git |
|
295 |
+set wildignore+=UPSTREAMS,FORKS |
|
296 |
+" Relative to `$HOME`. |
|
297 |
+set wildignore+=*/.vim/pack,*/.config/vim/pack,*/.config/nvim/pack |
|
298 |
+set wildignore+=*/.cache, |
|
299 |
+set wildignore+=*/.mozilla/firefox |
|
300 |
+set wildignore+=*/.local/lib,*/.local/share/man |
|
301 |
+set wildignore+=*/.vagrant,*/.ansible |
|
302 |
+set wildignore+=*/.local/pipx,__pycache__,.venv,*.egg-info |
|
303 |
+set wildignore+=*/.cargo |
|
304 |
+set wildignore+=*/.npm,node_modules |
|
305 |
+set wildignore+=*/.local/share/tldr |
|
306 |
+set wildignore+=*/snap |
|
307 |
+set wildignore+=*/.wine/dosdevices,*/.wine/drive_* |
|
308 |
+" <http://ftp.vim.org/pub/vim/patches/8.2/8.2.4325>: 'wildmenu' only shows few |
|
309 |
+" matches. Add the "pum" option: use a popup menu to show the matches. |
|
148 | 310 |
if has('patch-8.2.4325') |
149 |
- " See http://ftp.vim.org/pub/vim/patches/8.2/8.2.4325. |
|
150 | 311 |
set wildoptions+=pum |
151 | 312 |
endif |
152 | 313 |
|
... | ... |
@@ -163,8 +324,9 @@ set ttimeoutlen=100 |
163 | 324 |
""" Diffs |
164 | 325 |
set diffopt+=vertical |
165 | 326 |
set diffopt+=foldcolumn:0 |
327 |
+" <http://ftp.vim.org/pub/vim/patches/8.1/8.1.0360>: Using an external diff |
|
328 |
+" program is slow and inflexible. Include the xdiff library. Use it by default. |
|
166 | 329 |
if has('patch-8.1.0360') |
167 |
- " See http://ftp.vim.org/pub/vim/patches/8.1/8.1.0360. |
|
168 | 330 |
set diffopt+=internal |
169 | 331 |
set diffopt+=algorithm:histogram |
170 | 332 |
set diffopt+=indent-heuristic |
... | ... |
@@ -173,29 +335,72 @@ endif |
173 | 335 |
""" Formatting |
174 | 336 |
" See |auto-format|, |format-comments|, and |fo-table|. |
175 | 337 |
set textwidth=79 |
176 |
-set winwidth=80 |
|
338 |
+" set winwidth=80 |
|
177 | 339 |
" set colorcolumn=+1 |
178 | 340 |
set autoindent |
179 | 341 |
set nojoinspaces |
342 |
+" Don't autowrap text, enable comment formatting with |gq|, recognize lists, |
|
343 |
+" remove comment leader when joining. |
|
180 | 344 |
set formatoptions-=t |
181 |
-set formatoptions+=q |
|
345 |
+" set formatoptions+=q " TODO: This is the default? |
|
182 | 346 |
set formatoptions+=n |
183 | 347 |
set formatoptions+=j |
184 |
-set nowrap |
|
348 |
+set nowrap " See also |breakindent|, |breakindentopt|, |showbreak| set above. |
|
349 |
+" A custom 'formatprg' produces nicer results but is harder to replicate for |
|
350 |
+" others and places undue burden on documentation contributors. Having simple |
|
351 |
+" format rules is more important than slightly prettier formatting. |
|
352 |
+" TODO: At least make the expressions valid (we're lacking spaces, no?). |
|
353 |
+" if executable('par') |
|
354 |
+" let &formatprg = join(['par', 'T'.&tabstop, 'w'.&textwidth, 'e']) |
|
355 |
+" let &formatprg = join(['par', 'T'.&tabstop, 'w'.&textwidth, 'e', 'j']) |
|
356 |
+" elseif executable('fmt') |
|
357 |
+" let &formatprg = 'fmt' . '-w' . &textwidth '-g' . &textwidth |
|
358 |
+" endif |
|
185 | 359 |
|
186 | 360 |
""" Comments |
187 |
-set commentstring= |
|
361 |
+" set commentstring=#%s |
|
188 | 362 |
|
189 | 363 |
""" Folds |
190 | 364 |
set foldlevelstart=999 |
191 | 365 |
set foldtext=substitute(getline(v:foldstart),'\\t',repeat('\ ',&ts),'g').'\ ' |
192 | 366 |
|
193 | 367 |
""" Spelling |
194 |
-set spell |
|
368 |
+" set spell |
|
195 | 369 |
set spelllang=en_us |
196 |
-" `thesaurus/en_us.txt` downloaded from URL documented in |'thesaurus'|: |
|
197 |
-" https://github.com/vim/vim/issues/629#issuecomment-443293282. |
|
198 | 370 |
set thesaurus=~/.vim/thesaurus/en_us.txt |
371 |
+" TODO: We can probably do something better/cleaner for the thesaurus on our |
|
372 |
+" own. In particular, publicly available, clearly licensed, version controlled, |
|
373 |
+" code to generate the vim thesaurus from primary sources. |
|
374 |
+" The current `~/.vim/thesaurus/en_us.txt` is downloaded from the URL |
|
375 |
+" documented in |'thesaurus'|: |
|
376 |
+" <https://github.com/vim/vim/issues/629#issuecomment-443293282>. This zip file |
|
377 |
+" contains a patch to <https://www.openoffice.org/lingucomponent/MyThes-1.zip> |
|
378 |
+" and the results of running the patched code on the included files, as well as |
|
379 |
+" the licenses. `MyThes-1.zip` is linked from |
|
380 |
+" <https://www.openoffice.org/lingucomponent/thesaurus.html> and seems to be |
|
381 |
+" some version of <https://github.com/hunspell/mythes>. MyThes states in its |
|
382 |
+" readme that it is based on WordNet 2.0. However, the latest version as of |
|
383 |
+" this writing is 3.1. When generating a Vim version, it helps to have a |
|
384 |
+" visualization to guide the heuristics that will probably be needed. Searching |
|
385 |
+" <https://wordnet.princeton.edu/related-projects> for "thesaurus" gives |
|
386 |
+" several projects. <https://wordvis.com> looks good (try e.g. "completion"). |
|
387 |
+" Another search hit, |
|
388 |
+" <https://www2.seas.gwu.edu/~simhaweb/software/jword/index.html>, states that |
|
389 |
+" "WordNet's vocabulary is smaller than other "word" databases", so we might |
|
390 |
+" want to use other sources as well, e.g. Roget's Thesaurus. |
|
391 |
+" |
|
392 |
+" WordNet |
|
393 |
+" - <https://wordnet.princeton.edu/download/current-version> |
|
394 |
+" - <https://wordnetcode.princeton.edu/wn3.1.dict.tar.gz> |
|
395 |
+" Data hosted on Project Gutenberg |
|
396 |
+" - <https://www.gutenberg.org/ebooks/3202> (2002) Moby Thesaurus List |
|
397 |
+" - <https://www.gutenberg.org/ebooks/10681> (2004) Roget's Thesaurus of English Words and Phrases |
|
398 |
+" - <https://www.gutenberg.org/ebooks/22> (1991) Roget's Thesaurus |
|
399 |
+" - <https://www.gutenberg.org/ebooks/38390> (2011) A Dictionary of English Synonymes [...] |
|
400 |
+" - <https://www.gutenberg.org/ebooks/51155> (2016) A Complete Dictionary of Synonyms and Antonyms |
|
401 |
+" For Swedish, there is |
|
402 |
+" - <https://folkets-lexikon.csc.kth.se/synlex.html> |
|
403 |
+" - <https://spraakbanken.gu.se/en/resources/saldo> |
|
199 | 404 |
|
200 | 405 |
""" Views |
201 | 406 |
set viewoptions-=options |
... | ... |
@@ -205,18 +410,38 @@ set viewoptions+=unix |
205 | 410 |
""" Files |
206 | 411 |
set swapfile |
207 | 412 |
set writebackup |
413 |
+set backupcopy=yes |
|
208 | 414 |
set undofile |
209 | 415 |
set directory=~/.cache/vim/swap// |
210 | 416 |
set backupdir=~/.cache/vim/backup// |
211 | 417 |
set undodir=~/.cache/vim/undo// |
212 | 418 |
set viewdir=~/.cache/vim/view// |
213 | 419 |
set viminfofile=~/.cache/vim/viminfo |
420 |
+if has('nvim') |
|
421 |
+ set shadafile= |
|
422 |
+endif |
|
423 |
+ |
|
424 |
+""" Conceal |
|
425 |
+set conceallevel=2 |
|
426 |
+set concealcursor=nc |
|
427 |
+ |
|
428 |
+""" Platform |
|
429 |
+set shellslash |
|
430 |
+ |
|
431 |
+""" External tools |
|
432 |
+" Not POSIX: `-H` (suggested in 'grepprg'), `-I`. |
|
433 |
+set grepprg=grep\ -nHI |
|
434 |
+ |
|
435 |
+""" Quickfix |
|
436 |
+set switchbuf=useopen |
|
214 | 437 |
|
215 | 438 |
"" Mappings |
439 |
+" TODO: Categorize into map modes. Use the nonspecific |:map| (|mapmode-nvo|) |
|
440 |
+" and |:map!| (|mapmode-ic|) more often? |
|
216 | 441 |
|
217 | 442 |
""" Escape |
218 | 443 |
" Overwrites the default |i_CTRL-C|, |v_CTRL-C|. See |
219 |
-" https://vim.fandom.com/wiki/Avoid_the_escape_key. |
|
444 |
+" <https://vim.fandom.com/wiki/Avoid_the_escape_key>. |
|
220 | 445 |
inoremap <C-C> <Esc> |
221 | 446 |
xnoremap <C-C> <Esc> |
222 | 447 |
|
... | ... |
@@ -230,31 +455,77 @@ tnoremap <C-J> <C-W>j |
230 | 455 |
tnoremap <C-K> <C-W>k |
231 | 456 |
tnoremap <C-L> <C-W>l |
232 | 457 |
|
233 |
-""" Buffers |
|
234 |
-nnoremap <Space><Space>bb :ls<CR>:b<Space> |
|
235 |
-nnoremap <Space><Space>bs :ls<CR>:sb<Space> |
|
236 |
-nnoremap <Space><Space>bv :ls<CR>:vertical sb<Space> |
|
458 |
+""" Clear and redraw |
|
459 |
+" <C-L> is overridden above, so use a <Leader> mapping. |
|
460 |
+nnoremap <Space><C-L> <C-L> |
|
461 |
+ |
|
462 |
+""" Movement |
|
463 |
+" Up down dispaly lines (unless a count is given). |
|
464 |
+nnoremap <expr> j v:count ? 'j' : 'gj' |
|
465 |
+nnoremap <expr> k v:count ? 'k' : 'gk' |
|
466 |
+ |
|
467 |
+" End of pair opened at end of current line. |
|
468 |
+" TODO: These are overridden by `matchit`. |
|
469 |
+nnoremap <silent> g% :<C-U>norm! $%<CR> |
|
470 |
+onoremap <silent> g% :<C-U>norm! $%<CR> |
|
471 |
+xnoremap <silent> g% :<C-U>norm! v$%<CR> |
|
472 |
+ |
|
473 |
+""" Scrolling |
|
474 |
+" Put paragraph containing cursor line at the top of the window. |
|
475 |
+" TODO: Preserve jump list somehow? |
|
476 |
+nnoremap zg {jzt<C-O> |
|
477 |
+ |
|
478 |
+""" Visual mode repeat |
|
479 |
+" See also `vim-visualrepeat`. |
|
480 |
+xnoremap . :normal! .<CR> |
|
481 |
+ |
|
482 |
+""" Clipboard |
|
483 |
+" Yank file and line number of cursor. |
|
484 |
+nnoremap <silent> <Space>yy :let @+ = expand('%:p') . ':' . line('.')<CR> |
|
237 | 485 |
|
238 | 486 |
""" `$MYVIMRC` |
239 | 487 |
nnoremap <silent> <Space><Space>ve :edit $MYVIMRC<CR> |
240 | 488 |
nnoremap <silent> <Space><Space>vs :source $MYVIMRC<CR> |
241 | 489 |
|
490 |
+""" Keyword |
|
491 |
+" nnoremap K :silent execute "normal! K" \| redraw!<CR> |
|
492 |
+" nnoremap <silent> K :terminal ++close <C-R>=&keywordprg<CR> <cword><CR> |
|
493 |
+" TODO: vnoremap |
|
494 |
+" TODO: `set keywordprg=:help` |
|
495 |
+ |
|
242 | 496 |
""" Help |
497 |
+" TODO: Make this filetype dependent? Could use |:grep| or |fugitive|'s |
|
498 |
+" |:Ggrep|. On the other hand, there are other built-in mappings that does |
|
499 |
+" keyword search in a codebase. |
|
500 |
+" TODO: Here we use `g` as prefix. Do we do that in other places? Should we not |
|
501 |
+" use <Leader> (i.e. <Space>)? |
|
243 | 502 |
nnoremap <silent> gK :helpgrep \<<C-R><C-W>\><CR> |
244 | 503 |
xnoremap <silent> gK y:helpgrep <C-R>"<CR> |
245 | 504 |
|
246 | 505 |
""" Run |
506 |
+" TODO: Standardize where the output goes. |
|
247 | 507 |
|
248 |
-" File. |
|
508 |
+" File (with output in pager). |
|
249 | 509 |
nnoremap <silent> <Space><Space>% :!%:p:S \| less -FR<CR> |
250 | 510 |
nnoremap <silent> <Space><Space># :!#:p:S \| less -FR<CR> |
251 | 511 |
|
252 |
-" Command. |
|
512 |
+" Command (with output in new window). |
|
253 | 513 |
nnoremap <Space><Space>! :new \| .! |
254 | 514 |
|
515 |
+""" Quickfix |
|
516 |
+ |
|
517 |
+"""" Toggle Quickfix window |
|
518 |
+" TODO: Do similar for location list? |
|
519 |
+" TODO: Make the |botright| global with some |autocmd|? |
|
520 |
+nnoremap <expr> <Space><Space>q |
|
521 |
+\ empty(filter(range(1,winnr('$')),'getwinvar(v:val,"&buftype")==#"quickfix"')) |
|
522 |
+\ ? ':botright copen<CR>' |
|
523 |
+\ : ':botright cclose<CR>' |
|
524 |
+ |
|
255 | 525 |
""" Make |
256 | 526 |
" TODO: |dispatch| provides default mappings, try to emulate them? |
257 | 527 |
" TODO: Should these be <silent> as well? |
528 |
+" TODO: Use the |terminal-debugger| instead of a make target? |
|
258 | 529 |
nnoremap <Space><Space>m% :!make %:r:S \| less -FR<CR> |
259 | 530 |
nnoremap <Space><Space>m# :!make #:r:S \| less -FR<CR> |
260 | 531 |
nnoremap <Space><Space>mm :!make \| less -FR<CR> |
... | ... |
@@ -288,11 +559,17 @@ nnoremap Y y$ |
288 | 559 |
"""" Don't include newline in Visual mode `$`. |
289 | 560 |
xnoremap $ $h |
290 | 561 |
|
291 |
-"""" Visual mode paste doesn't clobber unnamed register |
|
292 |
-xnoremap p pgvy |
|
562 |
+"""" Visual mode put that doesn't clobber unnamed register |
|
563 |
+" See also <http://ftp.vim.org/pub/vim/patches/8.2/8.2.4242>. |
|
564 |
+xnoremap P pgvy |
|
565 |
+ |
|
566 |
+""" Visual mode |
|
293 | 567 |
|
294 | 568 |
"""" Visually select last pasted text |
295 | 569 |
" TODO: Make a text object as well? |
570 |
+" TODO: I use this relatively often, but it clobbers the built in |gp|. I never |
|
571 |
+" use that, but it seems useful, so maybe I should? Find another natural |
|
572 |
+" mapping? |
|
296 | 573 |
" Analogous with how |gv| visually selects last visually selected text. Default |
297 | 574 |
" to always using ordinary Visual mode. Linewise and blockwise with |+eval| |
298 | 575 |
" support. |
... | ... |
@@ -304,13 +581,34 @@ endif |
304 | 581 |
"""" Restrict Visual mode substitutions to the selected text |
305 | 582 |
xnoremap <Space>s :s/\%V |
306 | 583 |
|
584 |
+"""" Visual movement |
|
585 |
+xnoremap <C-h> hoho |
|
586 |
+xnoremap <C-j> jojo |
|
587 |
+xnoremap <C-k> koko |
|
588 |
+xnoremap <C-l> lolo |
|
589 |
+ |
|
590 |
+""" Scrolling |
|
591 |
+" Arrow keys scroll. Useful when 'mouse' is empty and the terminal sends arrow |
|
592 |
+" keys when scrolling with the mouse. |
|
593 |
+noremap <Up> <C-Y> |
|
594 |
+noremap <Down> <C-E> |
|
595 |
+noremap <Left> zh |
|
596 |
+noremap <Right> zl |
|
597 |
+ |
|
307 | 598 |
""" Mouse |
308 | 599 |
" As suggested in |scroll-mouse-wheel|, scroll only one line. |
309 |
-noremap <MouseUp> <C-E> |
|
310 |
-noremap <MouseDown> <C-Y> |
|
600 |
+noremap <ScrollWheelUp> <C-Y> |
|
601 |
+noremap <ScrollWheelDown> <C-E> |
|
602 |
+noremap <C-ScrollWheelUp> zh |
|
603 |
+noremap <C-ScrollWheelDown> zl |
|
604 |
+noremap <ScrollWheelLeft> zh |
|
605 |
+noremap <ScrollWheelRight> zl |
|
311 | 606 |
|
312 | 607 |
" Toggle folds. |
313 |
-noremap <RightMouse> <LeftMouse>za |
|
608 |
+noremap <RightMouse> <LeftMouse>za |
|
609 |
+noremap <2-RightMouse> <LeftMouse>za |
|
610 |
+noremap <3-RightMouse> <LeftMouse>za |
|
611 |
+noremap <4-RightMouse> <LeftMouse>za |
|
314 | 612 |
|
315 | 613 |
""" Command-line |
316 | 614 |
" Take already written text into account when searching history. |
... | ... |
@@ -333,9 +631,29 @@ endif |
333 | 631 |
""" Diffs |
334 | 632 |
|
335 | 633 |
" Current file. |
336 |
-nnoremap <silent> <Space><Space>dd :w !diff --color=always -u %:S - \| less -FR<CR> |
|
634 |
+" Se also |:DiffOrig|. |
|
635 |
+" TODO: Use a buffer? |
|
636 |
+" <https://gist.github.com/romainl/7198a63faffdadd741e4ae81ae6dd9e6> |
|
637 |
+nnoremap <silent> <Space><Space>dd :w ! |
|
638 |
+\ diff -u --color=always %:S - |
|
639 |
+\ \| tail -n +3 |
|
640 |
+\ \| less -FR |
|
641 |
+\ <CR> |
|
642 |
+nnoremap <silent> <Space><Space>dw :w ! |
|
643 |
+\ diff -u %:S - |
|
644 |
+\ \| tail -n +3 |
|
645 |
+\ \| wdiff -d -n |
|
646 |
+\ -w "$([ "$(tput colors)" -ge 16 ] && tput setaf 9 \|\| { tput bold; tput setaf 1; })" |
|
647 |
+\ -y "$([ "$(tput colors)" -ge 16 ] && tput setaf 10 \|\| { tput bold; tput setaf 2; })" |
|
648 |
+\ -x "$([ "$(tput colors)" -ge 16 ] && tput setaf 15 \|\| { tput bold; tput setaf 7; })" |
|
649 |
+\ -z "$([ "$(tput colors)" -ge 16 ] && tput setaf 15 \|\| { tput bold; tput setaf 7; })" |
|
650 |
+\ \| less -FR |
|
651 |
+\ <CR> |
|
652 |
+" Requires `vim-fugitive`. |
|
653 |
+nmap <silent> <Space><Space>dg :Gdiffsplit<CR> |
|
337 | 654 |
|
338 | 655 |
" Analogous with |dp| |do| in Normal mode. |
656 |
+" TODO: Is adding a `diffupdate` at the end useful? |
|
339 | 657 |
nnoremap <silent> <Space>dpp :.diffput<CR> |
340 | 658 |
nnoremap <silent> <Space>doo :.diffget<CR> |
341 | 659 |
xnoremap <silent> <Space>dp :diffput<CR> |
... | ... |
@@ -365,6 +683,7 @@ nnoremap zV zMzv |
365 | 683 |
|
366 | 684 |
" Focus next/previous fold. Overwrites default move to start/end of |
367 | 685 |
" next/previous fold. |
686 |
+" TODO: |c_CTRL-R_=| requires |+eval|? |
|
368 | 687 |
nnoremap <silent> zj m<zjzvm>gvzc'>zv |
369 | 688 |
nnoremap <silent> zk zvzckVzvV:<C-R>=prevnonblank(line('.'))<CR><CR>zvzcVoVzv |
370 | 689 |
|
... | ... |
@@ -399,33 +718,125 @@ if has('eval') |
399 | 718 |
endfunction |
400 | 719 |
endif |
401 | 720 |
|
721 |
+""" Normalize date to ISO 8601 |
|
722 |
+" See |:visual_example|. |
|
723 |
+" See also |abolish-coercion|. |
|
724 |
+" This is hacky but works without |+eval|. |
|
725 |
+xnoremap crd <Esc>`>a<CR><Esc>`<i<CR><Esc>!!date +'\%Y-\%m-\%d' -f -<CR>kJJ |
|
726 |
+ |
|
727 |
+""" Go to string in file under cursor |
|
728 |
+ |
|
729 |
+" The built-in |gF|, and related |CTRL-W_F|, |CTRL-W_gF|, commands extend |gf| |
|
730 |
+" by also parsing trailing `:{lineno}` (specifically, any non-filename |
|
731 |
+" character optionally surrounded by whitespace, or the literal string |
|
732 |
+" ` line `, followed by a decimal number). This corresponds to common output of |
|
733 |
+" compilers/interpreters/linters. It also happens to roughly correspond to |
|
734 |
+" _one_ of the common (or, for [POSIX.1-2017][], allowed) outputs of `ctags`. |
|
735 |
+" It does not however allow the _other_ format: search strings. Let's fix that. |
|
736 |
+" |
|
737 |
+" Search strings are very useful when you're not sure what version of the file |
|
738 |
+" someone else might have, so it's hard to give an accurate line number, but |
|
739 |
+" the chance is high that a search string will yield the correct location. It |
|
740 |
+" also conveys more information to someone not wanting to _follow_ the |
|
741 |
+" reference right now than a line number would. |
|
742 |
+" |
|
743 |
+" Vim actually allows _any_ Ex command in tag files (subject to |'exrc'| and |
|
744 |
+" |'secure'|, see |tag-security|), not just line numbers and search strings, |
|
745 |
+" see |tags-file-format|. The mapping below only accepts what amounts to |
|
746 |
+" possibly anchored non-regex search strings, for three reasons: 1) security, |
|
747 |
+" 2) implementation simplicity, 3) it is what [POSIX.1-2017][] `ctags` / `ex` / |
|
748 |
+" `vi` supports. |
|
749 |
+" |
|
750 |
+" It is important that we lean on the built-in mappings as much as possible |
|
751 |
+" since they include functionality based on <count>, |'isfname'|, |'path'|, |
|
752 |
+" |'suffixesadd'|, and |'includeexpr'|, special handling of escaped spaces and |
|
753 |
+" trailing punctuation, as well as home directory and environment variable |
|
754 |
+" expansion (|expandcmd|) that would be hard to re-implement, see |gf|. Note |
|
755 |
+" that the built-in mappings only trigger when the cursor is on or before the |
|
756 |
+" _filename_, not on the address. |gF| falls back to |gf| functionality without |
|
757 |
+" giving an error message if a traling line number can't be found, which we |
|
758 |
+" mimic. |
|
759 |
+" |
|
760 |
+" [POSIX.1-2017]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ctags.html#tag_20_27_12 |
|
761 |
+ |
|
762 |
+" TODO: Also support `file:line:col`? |
|
763 |
+ |
|
764 |
+if has('eval') |
|
765 |
+ nnoremap gF :<C-U>call <SID>gf("gF")<CR> |
|
766 |
+ nnoremap <C-W>F :<C-U>call <SID>gf("\<lt>C-W>F")<CR> |
|
767 |
+ nnoremap <C-W>gF :<C-U>call <SID>gf("\<lt>C-W>gF")<CR> |
|
768 |
+ function! s:gf(cmd) abort |
|
769 |
+ let back = '\\\\' |
|
770 |
+ let fwd = '\\\/' |
|
771 |
+ let dollar = '\$\/\@!' |
|
772 |
+ let other = '[^\/$]' |
|
773 |
+ let chr = '\%(' . join([back, fwd, dollar, other], '\|') . '\)' |
|
774 |
+ let str = '\(' . chr . '\+\)' |
|
775 |
+ let start = '\(\^\?\)' |
|
776 |
+ let end = '\(\$\?\)' |
|
777 |
+ let addr = '\/' . start . str . end . '\/' |
|
778 |
+ let after = '\%>' . (col('.')-1) . 'c' |
|
779 |
+ let file = '[[:fname:]]' |
|
780 |
+ let sep = '[[:space:]]*[^[:fname:][:digit:]/][[:space:]]*' |
|
781 |
+ let pat = '\m' . after . file . sep . addr |
|
782 |
+ let match = matchlist(getline('.'), pat) |
|
783 |
+ execute 'normal!' (v:count1 . a:cmd) |
|
784 |
+ if !empty(match) |
|
785 |
+ let start = match[1] |
|
786 |
+ let str = match[2] |
|
787 |
+ let end = match[3] |
|
788 |
+ let pat = '\C' . '\m' . start . '\V' . str . '\m' . end |
|
789 |
+ call cursor(1, 1) |
|
790 |
+ if search(pat, 'c') == 0 |
|
791 |
+ echo "Could not find search string:" (start . str . end) |
|
792 |
+ endif |
|
793 |
+ endif |
|
794 |
+ endfunction |
|
795 |
+endif |
|
796 |
+ |
|
797 |
+"" Commands |
|
798 |
+ |
|
799 |
+""" Fill quickfix with output from system command |
|
800 |
+" TODO: |<q-args>| does not seem to escape quotes, so things like `Cexpr echo |
|
801 |
+" 'hello'` does not work. Probably passing it to a function so that we get a |
|
802 |
+" argument variable to call |shellescape| on is required? |
|
803 |
+" TODO: How does this compare to |dispatch|? |
|
804 |
+command! -bang -complete=shellcmd -nargs=+ Cexpr |
|
805 |
+\ execute (empty(<q-bang>)?'cexpr':'cgetexpr') 'system(expandcmd(' escape(<q-args>, "'") '))' |
|
806 |
+ |
|
807 |
+""" Run `git ls` and preview commits on cursor move |
|
808 |
+" Requires `vim-fugitive` and a `ls`/`lsa` Git alias. |
|
809 |
+command! -bar Gls |
|
810 |
+\ Git ls | |
|
811 |
+\ execute 'nmap <silent> <buffer> j j:silent vert Gpedit <cword><CR><C-W>=' | |
|
812 |
+\ execute 'nmap <silent> <buffer> k k:silent vert Gpedit <cword><CR><C-W>=' | |
|
813 |
+\ execute 'autocmd vimrc BufUnload <buffer> pclose' | |
|
814 |
+command! -bar Glsa |
|
815 |
+\ Git lsa | |
|
816 |
+\ execute 'nmap <silent> <buffer> j j:silent vert Gpedit <cword><CR><C-W>=' | |
|
817 |
+\ execute 'nmap <silent> <buffer> k k:silent vert Gpedit <cword><CR><C-W>=' | |
|
818 |
+\ execute 'autocmd vimrc BufUnload <buffer> pclose' | |
|
819 |
+ |
|
402 | 820 |
"" Auto commands |
403 | 821 |
" Make sure to not define any |autocmd|s before this! |
404 | 822 |
augroup vimrc |
405 | 823 |
autocmd! |
406 | 824 |
augroup END |
407 | 825 |
|
408 |
-""" Open the QuickFix/Location list window |
|
409 |
-" See |
|
410 |
-" - https://github.com/tpope/vim-dispatch/issues/145 |
|
411 |
-" - https://github.com/tpope/vim-dispatch/issues/254 |
|
412 |
-" - https://github.com/tpope/vim-dispatch/issues/310 |
|
413 |
-" autocmd vimrc QuickFixCmdPost *{make,{,vim}grep}* nested botright cwindow |
|
414 |
-" autocmd vimrc QuickFixCmdPost *l{make,{,vim}grep}* nested botright lwindow |
|
826 |
+""" Hacks for options that Vim likes to reset |
|
415 | 827 |
|
416 |
-""" Highlight all searches |
|
417 |
-" |'incsearch'| only highlights the first match. |
|
418 |
-autocmd vimrc CmdlineEnter /,\? let s:hlsearch = &hlsearch | set hlsearch |
|
419 |
-autocmd vimrc CmdlineLeave /,\? let &hlsearch = s:hlsearch |
|
828 |
+" `$VIMRUNTIME/colors/default.vim` |
|
829 |
+autocmd vimrc OptionSet background set background=dark |
|
420 | 830 |
|
421 | 831 |
""" Save/load view |
422 |
-" As suggested in |:loadview|, load auto-saved view when opening buffer. Better |
|
423 |
-" than |last-position-jump|, |restore-cursor|. |
|
424 |
-autocmd vimrc BufWinEnter * |
|
832 |
+" Roughly as suggested in |:loadview|, load auto-saved view when opening |
|
833 |
+" buffer. Better than |last-position-jump|, |restore-cursor|. See also |
|
834 |
+" |'viewoptions'|. |
|
835 |
+autocmd vimrc BufWinEnter,BufRead * |
|
425 | 836 |
\ if !empty(expand('<afile>')) && empty(&buftype) | |
426 | 837 |
\ loadview | |
427 | 838 |
\ endif | |
428 |
-autocmd vimrc BufWinLeave * |
|
839 |
+autocmd vimrc BufWinLeave,BufWrite * |
|
429 | 840 |
\ if !empty(expand('<afile>')) && empty(&buftype) | |
430 | 841 |
\ mkview | |
431 | 842 |
\ endif | |
... | ... |
@@ -433,75 +844,223 @@ autocmd vimrc BufWinLeave * |
433 | 844 |
""" Don't show extra things in special buffers |
434 | 845 |
" TODO: This needs to be moved to after the plugins for it to work in e.g. |
435 | 846 |
" fugitive? |
436 |
-autocmd vimrc WinEnter,TerminalWinOpen * |
|
437 |
-\ if &buftype !=# '' | |
|
438 |
-\ silent setlocal nolist nospell | |
|
439 |
-\ endif |
|
847 |
+if !has('nvim') |
|
848 |
+ autocmd vimrc BufReadPost,TerminalWinOpen * |
|
849 |
+ \ if !empty(&buftype) | |
|
850 |
+ \ silent setlocal nolist nospell | |
|
851 |
+ \ endif |
|
852 |
+endif |
|
853 |
+ |
|
854 |
+""" QuickFix/Location list |
|
855 |
+ |
|
856 |
+"""" Open window |
|
857 |
+" See |
|
858 |
+" - <https://github.com/tpope/vim-dispatch/issues/145> |
|
859 |
+" - <https://github.com/tpope/vim-dispatch/issues/254> |
|
860 |
+" - <https://github.com/tpope/vim-dispatch/issues/310> |
|
861 |
+" TODO: Maybe this can be fixed by switching back to the previous window after |
|
862 |
+" opening the quickfix window? Make sure to only switch to the previous if we |
|
863 |
+" actually opened the window. |
|
864 |
+" autocmd vimrc QuickFixCmdPost [^l]* nested botright cwindow |
|
865 |
+" autocmd vimrc QuickFixCmdPost l* nested botright lwindow |
|
866 |
+" autocmd vimrc QuickFixCmdPost {{make,{,vim}grep{,add}},c{,get,add}{expr,file,buffer}} nested botright cwindow |
|
867 |
+" autocmd vimrc QuickFixCmdPost {l{make,{,vim}grep{,add}},l{,get,add}{expr,file,buffer}} nested botright lwindow |
|
868 |
+ |
|
869 |
+"""" Conceal column numbers |
|
870 |
+autocmd vimrc BufReadPost quickfix |
|
871 |
+\ setlocal conceallevel=2 concealcursor=nvic nonumber | |
|
872 |
+\ syntax match qfColumnNr / col \d\+/ containedin=qfLineNr transparent conceal | |
|
873 |
+ |
|
874 |
+""" Highlight all searches |
|
875 |
+" |'incsearch'| only highlights the first match. |
|
876 |
+if has('eval') |
|
877 |
+ autocmd vimrc CmdlineEnter /,\? let s:hlsearch = &hlsearch | set hlsearch |
|
878 |
+ autocmd vimrc CmdlineLeave /,\? let &hlsearch = s:hlsearch |
|
879 |
+endif |
|
440 | 880 |
|
441 | 881 |
"" Colors |
442 | 882 |
" See |cterm-colors|, |gui-colors|. |
443 | 883 |
|
444 |
-""" Overrides |
|
445 |
-" Transparent background, greyscale interface. Sensible errors/warnings, |
|
884 |
+silent !. ~/.shrc.d/color.sh |
|
885 |
+" redraw! |
|
886 |
+ |
|
887 |
+" TODO: Document that |autocmd| is available in "tiny" (i.e. always) but |
|
888 |
+" |+syntax| requires "normal", so doing it the way we're doing it makes sure it |
|
889 |
+" works everywhere. This is especially important for interface highlights |
|
890 |
+" (|listchars|). |
|
891 |
+ |
|
892 |
+" TODO: This is getting ridiculous. |:syntax-on| suggests we can just use |
|
893 |
+" |:highlight| outside any |autocmd|s and it will work. Look into this. |
|
894 |
+ |
|
895 |
+" TODO: Support `has('gui_running')` and |'termguicolors'|. Look into e.g. |
|
896 |
+" |g:terminal_ansi_colors|. |
|
897 |
+ |
|
898 |
+""" General |
|
899 |
+" Transparent background, grayscale interface. Sensible errors/warnings, |
|
446 | 900 |
" spellchecking, diffs, comments, and todos. See |:hi-normal| and |
447 | 901 |
" |:hi-normal-cterm|. |
448 | 902 |
|
449 | 903 |
if !has('gui_running') |
450 |
- autocmd vimrc VimEnter,ColorScheme * |
|
904 |
+ autocmd vimrc ColorScheme * nested |
|
451 | 905 |
\ highlight! Normal guibg=NONE | |
452 | 906 |
endif |
453 | 907 |
|
454 |
-" TODO: Look at all in |'highlight'|. |
|
455 |
-autocmd vimrc VimEnter,ColorScheme * |
|
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'| |
|
486 |
-autocmd vimrc VimEnter,ColorScheme * |
|
487 |
-\ highlight! link SpecialKey Special | |
|
488 |
-\ highlight! link NonText Special | |
|
489 |
- |
|
490 |
-""" Folds |
|
491 |
-autocmd vimrc VimEnter,ColorScheme * |
|
492 |
-\ highlight! link Folded Comment | |
|
908 |
+" TODO: Look at all in |'highlight'| (in particular |hl-Search|) and |highlight-default|. |
|
909 |
+" TODO: This could be done by setting |'highlight'| instead of monkying around |
|
910 |
+" with highlight groups. Unclear if better. |
|
911 |
+" TODO: For all chromatic colors, use `Light*`. |
|
912 |
+" TODO: Remove all `White` except `Normal` from this list and link them to `Normal`? |
|
913 |
+" TODO: Remove all `Gray` except `Comment` from this list and link them to `Comment`? |
|
914 |
+" NOTE: When |hl-StatusLine| is a |:hi-link| Vim cannot determine if it's equal |
|
915 |
+" to |hl-StatusLineNC| and uses "^^^". Same for `StatusLineTerm{,NC}`. See |
|
916 |
+" `src/drawscreen.c:550` (at the bottom of the funtion `win_redr_status`) in |
|
917 |
+" the Vim source. |
|
918 |
+" TODO: Since the Linux console cannot use `DarkGray` as a background, consider |
|
919 |
+" using any other `Dark*` color (e.g. `DarkYellow`) as (non-`reverse`) `Visual` |
|
920 |
+" `ctermbg` with `ctermfg=NONE`. NOTE: This requires that we standardize on |
|
921 |
+" `__color_set_uniform_diff_low`. `__color_set_uniform_diff_high` works (in |
|
922 |
+" fact is required) for `cterm=reverse ctermfg=NONE ctermbg=NONE`. |
|
923 |
+" TODO: Why do we need the `term=NONE`? Is this tested ever? Is it used in |
|
924 |
+" `vim.tiny`? |
|
925 |
+ |
|
926 |
+" TODO: Vim requests the background color from the terinal with the escape |
|
927 |
+" sequence |t_RB| and sets |'background'| when it gets the response |
|
928 |
+" (|v:termrbgresp|). That response may come after |vimrc| has completed, so if |
|
929 |
+" you want to do |:colorscheme| do it in a `autocmd vimrc OptionSet |
|
930 |
+" background`. |
|
931 |
+ |
|
932 |
+" autocmd vimrc ColorScheme * nested |
|
933 |
+" \ highlight Normal font='Monospace Regular 10' |
|
934 |
+ |
|
935 |
+" \ set background=dark | runtime syntax/syncolor.vim | |
|
936 |
+autocmd vimrc ColorScheme * nested |
|
937 |
+\ highlight Normal term=NONE cterm=NONE gui=NONE ctermbg=NONE ctermfg=White | |
|
938 |
+\ highlight Comment term=NONE cterm=NONE gui=NONE guibg=NONE ctermbg=NONE ctermfg=DarkGray | |
|
939 |
+\ highlight Todo term=NONE cterm=NONE gui=NONE guibg=NONE ctermbg=NONE ctermfg=White | |
|
940 |
+\ highlight Error term=NONE cterm=NONE gui=NONE guibg=NONE ctermbg=NONE ctermfg=LightRed | |
|
941 |
+\ highlight SpellBad term=NONE cterm=NONE gui=NONE guibg=NONE ctermbg=NONE ctermfg=LightRed | |
|
942 |
+\ highlight SpellOther term=NONE cterm=NONE gui=NONE guibg=NONE ctermbg=NONE ctermfg=LightRed | |
|
943 |
+\ highlight Visual term=NONE cterm=NONE gui=NONE ctermbg=LightGray ctermfg=NONE | |
|
944 |
+\ highlight Search term=NONE cterm=NONE gui=NONE ctermbg=DarkYellow ctermfg=NONE | |
|
945 |
+\ highlight DiffAdd term=NONE cterm=NONE gui=NONE ctermbg=DarkGreen ctermfg=NONE | |
|
946 |
+\ highlight DiffDelete term=NONE cterm=NONE gui=NONE ctermbg=DarkRed ctermfg=NONE | |
|
947 |
+\ highlight DiffChange term=NONE cterm=NONE gui=NONE ctermbg=DarkBlue ctermfg=NONE | |
|
948 |
+\ highlight DiffText term=NONE cterm=NONE gui=NONE ctermbg=DarkYellow ctermfg=NONE | |
|
949 |
+\ highlight diffAdded term=NONE cterm=NONE gui=NONE guibg=NONE ctermbg=NONE ctermfg=LightGreen | |
|
950 |
+\ highlight diffRemoved term=NONE cterm=NONE gui=NONE guibg=NONE ctermbg=NONE ctermfg=LightRed | |
|
951 |
+\ highlight StatusLine term=NONE cterm=NONE gui=NONE ctermbg=NONE ctermfg=White | |
|
952 |
+\ highlight StatusLineTerm term=NONE cterm=NONE gui=NONE ctermbg=NONE ctermfg=White | |
|
953 |
+\ highlight StatusLineNC term=NONE cterm=NONE gui=NONE guibg=NONE ctermbg=NONE ctermfg=DarkGray | |
|
954 |
+\ highlight StatusLineTermNC term=NONE cterm=NONE gui=NONE guibg=NONE ctermbg=NONE ctermfg=DarkGray | |
|
955 |
+\ highlight Ignore term=NONE cterm=NONE gui=NONE guibg=NONE ctermbg=NONE ctermfg=Black | |
|
956 |
+" \ highlight DiffAdd term=NONE cterm=NONE gui=NONE ctermbg=LightGreen ctermfg=Black | |
|
957 |
+" \ highlight DiffDelete term=NONE cterm=NONE gui=NONE ctermbg=LightRed ctermfg=Black | |
|
958 |
+" \ highlight DiffChange term=NONE cterm=NONE gui=NONE ctermbg=LightBlue ctermfg=Black | |
|
959 |
+" \ highlight DiffText term=NONE cterm=NONE gui=NONE ctermbg=LightYellow ctermfg=Black | |
|
960 |
+ |
|
961 |
+""" No bold |
|
962 |
+" Remove all `cterm=bold` set by default in `$VIMRUNTIME/syntax/syncolor.vim`. |
|
963 |
+" The Linux virtual console does typically not have a bold font. |
|
964 |
+autocmd vimrc ColorScheme * nested |
|
965 |
+\ highlight Identifier cterm=NONE ctermfg=LightCyan | |
|
966 |
+ |
|
967 |
+""" Debug |
|
968 |
+autocmd vimrc ColorScheme * nested |
|
969 |
+\ highlight debugPC term=reverse cterm=NONE gui=NONE guibg=DarkBlue ctermbg=DarkBlue guifg=NONE ctermfg=NONE | |
|
970 |
+\ highlight debugBreakpoint term=NONE cterm=NONE gui=NONE guibg=NONE ctermbg=NONE guifg=LightRed ctermfg=LightRed | |
|
971 |
+ |
|
972 |
+" set highlight-=s:StatusLine |
|
973 |
+" set highlight-=S:StatusLineNC |
|
974 |
+" set highlight-=z:StatusLineTerm |
|
975 |
+" set highlight-=Z:StatusLineTermNC |
|
976 |
+" set highlight+=s:Normal,z:Normal,S:Comment,Z:Comment |
|
977 |
+ |
|
978 |
+autocmd vimrc ColorScheme * nested |
|
979 |
+\ highlight! link TabLineSel Normal | |
|
980 |
+\ highlight! link ToolbarButton Comment | |
|
981 |
+" \ highlight! link StatusLine Normal | |
|
982 |
+" \ highlight! link StatusLineTerm Normal | |
|
983 |
+ |
|
984 |
+""" Interface |
|
985 |
+autocmd vimrc ColorScheme * nested |
|
986 |
+\ highlight! link TabLine Comment | |
|
987 |
+\ highlight! link TabLineFill Comment | |
|
988 |
+\ highlight! link ToolbarLine Comment | |
|
989 |
+\ highlight! link VertSplit Comment | |
|
990 |
+\ highlight! link LineNr Comment | |
|
991 |
+\ highlight! link Folded Comment | |
|
992 |
+\ highlight! link FoldColumn Comment | |
|
993 |
+\ highlight! link SignColumn Comment | |
|
994 |
+" \ highlight! link StatusLineNC Comment | |
|
995 |
+" \ highlight! link StatusLineTermNC Comment | |
|
996 |
+ |
|
997 |
+""" Errors/warnings |
|
998 |
+autocmd vimrc ColorScheme * nested |
|
999 |
+\ highlight! link ErrorMsg Error | |
|
1000 |
+\ highlight! link WarningMsg Error | |
|
1001 |
+ |
|
1002 |
+""" Spell |
|
1003 |
+autocmd vimrc ColorScheme * nested |
|
1004 |
+\ highlight! link SpellCap SpellOther | |
|
1005 |
+\ highlight! link SpellRare SpellOther | |
|
1006 |
+\ highlight! link SpellLocal SpellOther | |
|
1007 |
+ |
|
1008 |
+""" Visual |
|
1009 |
+autocmd vimrc ColorScheme * nested |
|
1010 |
+\ highlight! link VisualNOS Visual | |
|
1011 |
+\ highlight! link ColorColumn Visual | |
|
1012 |
+\ highlight! link CursorColumn Visual | |
|
1013 |
+\ highlight! link CursorLine Visual | |
|
1014 |
+\ highlight! link CursorLineNr Visual | |
|
1015 |
+ |
|
1016 |
+""" Popup menu |
|
1017 |
+" See |'showbreak'|, |'listchars'| `extends` `precedes` `eol`. |
|
1018 |
+autocmd vimrc ColorScheme * nested |
|
1019 |
+\ highlight Pmenu ctermbg=LightGray ctermfg=DarkGray | |
|
1020 |
+\ highlight PmenuSel ctermbg=LightGray ctermfg=White | |
|
1021 |
+\ highlight PmenuSbar ctermbg=DarkGray | |
|
1022 |
+ |
|
1023 |
+""" Non-document characters |
|
1024 |
+" See |'showbreak'|, |'listchars'| `extends` `precedes` `eol`. |
|
1025 |
+autocmd vimrc ColorScheme * nested |
|
1026 |
+\ highlight! link NonText Special | |
|
1027 |
+\ highlight! link EndOfBuffer Ignore | |
|
1028 |
+ |
|
1029 |
+""" Document non-printables characters |
|
1030 |
+" See |'listchars'| `tab`, `space`, `trail`, `nbsp`. |
|
1031 |
+autocmd vimrc ColorScheme * nested |
|
1032 |
+\ highlight! link SpecialKey Comment | |
|
1033 |
+ |
|
1034 |
+""" Document concealed characters |
|
1035 |
+" See |'listchars'| `conceal`. |
|
1036 |
+autocmd vimrc ColorScheme * nested |
|
1037 |
+\ highlight! link Conceal Ignore | |
|
493 | 1038 |
|
494 | 1039 |
""" Vim comments |
495 |
-autocmd vimrc VimEnter,ColorScheme * |
|
1040 |
+autocmd vimrc ColorScheme * nested |
|
496 | 1041 |
\ highlight! link vimCommentString vimComment | |
497 | 1042 |
\ highlight! link vimCommentTitle vimComment | |
498 | 1043 |
|
1044 |
+""" Apply |
|
1045 |
+" TODO: Move `syntax enable` to someplace before this? |
|
1046 |
+" TODO: `doautocmd vimrc ColorScheme` worked for everything except when using |
|
1047 |
+" Vim as `$MANPAGER`. Not sure if this is a problem with `vimrc` or |
|
1048 |
+" `.vim/ftplugin/man.vim`. We don't always `has('eval')` though. |
|
1049 |
+" echom &background |
|
1050 |
+" if has('eval') |
|
1051 |
+" colorscheme default |
|
1052 |
+" endif |
|
1053 |
+" echom &background |
|
1054 |
+doautocmd vimrc ColorScheme |
|
1055 |
+" autocmd vimrc VimEnter * nested doautocmd vimrc ColorScheme |
|
1056 |
+" autocmd vimrc OptionSet background,t_Co nested doautocmd vimrc ColorScheme |
|
1057 |
+ |
|
499 | 1058 |
"" Plugins |
500 | 1059 |
|
501 | 1060 |
if has('eval') |
502 | 1061 |
|
503 | 1062 |
""" GitAdd |
504 |
- " https://git.rcrnstn.net/rcrnstn/vim-gitadd |
|
1063 |
+ " <https://git.rcrnstn.net/rcrnstn/vim-gitadd> |
|
505 | 1064 |
|
506 | 1065 |
" Make sure to not enable |:syntax| and |:filetype| until all plugins that |
507 | 1066 |
" interact with them have been added! See |:packadd|. |
... | ... |
@@ -536,24 +1095,72 @@ if has('eval') |
536 | 1095 |
|
537 | 1096 |
" See |ft-man-plugin|. |
538 | 1097 |
let g:ft_man_folding_enable = 1 |
539 |
- runtime ftplugin/man.vim |
|
540 |
- setglobal keywordprg=:Man |
|
541 | 1098 |
|
542 |
- """" `sheerun/vim-polyglot` |
|
543 |
- GitAdd https://github.com/sheerun/vim-polyglot |
|
1099 |
+ " TODO: Should be easy to create a |'foldexpr'| that's better than the |
|
1100 |
+ " built-in `foldmethod=indent`. |
|
1101 |
+ " function s:manfold() abort |
|
1102 |
+ " foldlevel() |
|
1103 |
+ " endfunction |
|
1104 |
+ |
|
1105 |
+ " We're using our own |:ManHelp| instead. |
|
1106 |
+ " runtime ftplugin/man.vim |
|
1107 |
+ " setglobal keywordprg=:Man |
|
1108 |
+ |
|
1109 |
+ """" Built-in `asm` |
|
1110 |
+ |
|
1111 |
+ " See |ft-asm-syntax|. |
|
1112 |
+ let g:filetype_i = 'asm' |
|
1113 |
+ |
|
1114 |
+ """" `tpope/vim-markdown` |
|
1115 |
+ " GitAdd https://github.com/tpope/vim-markdown |
|
1116 |
+ |
|
1117 |
+ """" `preservim/vim-markdown` |
|
1118 |
+ GitAdd https://github.com/preservim/vim-markdown |
|
544 | 1119 |
|
545 | 1120 |
let g:vim_markdown_no_default_key_mappings = 1 |
1121 |
+ let g:vim_markdown_toc_autofit = 1 |
|
1122 |
+ let g:vim_markdown_math = 1 |
|
1123 |
+ let g:vim_markdown_frontmatter = 1 |
|
1124 |
+ let g:vim_markdown_no_extensions_in_markdown = 1 |
|
1125 |
+ |
|
1126 |
+ " " Defaults. |
|
1127 |
+ " " |vim-markdown-fenced-code-block-languages| |
|
1128 |
+ " let g:vim_markdown_fenced_languages = [ |
|
1129 |
+ " \ "c++=cpp", |
|
1130 |
+ " \ "viml=vim", |
|
1131 |
+ " \ "bash=sh", |
|
1132 |
+ " \ "ini=dosini", |
|
1133 |
+ " \ ] |
|
1134 |
+ " " Additions. |
|
1135 |
+ " call add(g:vim_markdown_fenced_languages, [ |
|
1136 |
+ " \ "diff", |
|
1137 |
+ " \ ]) |
|
1138 |
+ |
|
1139 |
+ |
|
1140 |
+ " <https://github.com/preservim/vim-markdown/issues/232> |
|
1141 |
+ " let g:vim_markdown_new_list_item_indent = 0 |
|
1142 |
+ " let g:vim_markdown_auto_insert_bullets = 0 |
|
1143 |
+ |
|
1144 |
+ """" `vim-pandoc/vim-pandoc-syntax` |
|
1145 |
+ " GitAdd https://github.com/vim-pandoc/vim-pandoc-syntax |
|
1146 |
+ |
|
1147 |
+ " Roughly as recommended in the readme. |
|
1148 |
+ " autocmd vimrc BufNewFile,BufFilePre,BufRead *.md set filetype=markdown.pandoc |
|
1149 |
+ |
|
1150 |
+ """" `sheerun/vim-polyglot` |
|
1151 |
+ GitAdd https://github.com/sheerun/vim-polyglot |
|
546 | 1152 |
|
547 | 1153 |
let g:polyglot_disabled = [ |
548 | 1154 |
\ 'sensible', |
549 | 1155 |
\ 'autoindent', |
1156 |
+ \ 'markdown', |
|
550 | 1157 |
\ ] |
551 | 1158 |
|
552 | 1159 |
"""" `tpope/vim-sleuth` |
553 | 1160 |
GitAdd https://github.com/tpope/vim-sleuth |
554 | 1161 |
|
555 | 1162 |
"""" `tpope/vim-apathy` |
556 |
- GitAdd https://github.com/tpope/vim-apathy |
|
1163 |
+ " GitAdd https://github.com/tpope/vim-apathy |
|
557 | 1164 |
|
558 | 1165 |
"""" `tpope/vim-scriptease` |
559 | 1166 |
GitAdd https://github.com/tpope/vim-scriptease |
... | ... |
@@ -570,6 +1177,12 @@ if has('eval') |
570 | 1177 |
" \ 'ext': '.md', |
571 | 1178 |
" \ }] |
572 | 1179 |
|
1180 |
+ """" `mhinz/vim-rfc` |
|
1181 |
+ GitAdd https://github.com/mhinz/vim-rfc |
|
1182 |
+ |
|
1183 |
+ """" `HiPhish/info.vim` |
|
1184 |
+ GitAdd https://gitlab.com/HiPhish/info.vim |
|
1185 |
+ |
|
573 | 1186 |
""" Normal mode |
574 | 1187 |
|
575 | 1188 |
"""" Built-in `matchit` |
... | ... |
@@ -579,9 +1192,20 @@ if has('eval') |
579 | 1192 |
"""" `tpope/vim-unimpaired` |
580 | 1193 |
GitAdd https://github.com/tpope/vim-unimpaired |
581 | 1194 |
|
1195 |
+ " <https://github.com/tpope/vim-unimpaired/issues?q=conceal> |
|
1196 |
+ " <https://github.com/tpope/vim-unimpaired/issues/105> |
|
1197 |
+ " <https://github.com/tpope/vim-unimpaired/pull/152> |
|
1198 |
+ nnoremap yoe :setlocal conceallevel=<C-R>=&conceallevel == 0 ? 2 : 0<CR><CR> |
|
1199 |
+ nnoremap [oe :setlocal conceallevel=<C-R>=&conceallevel == 0 ? 0 : &conceallevel - 1<CR><CR> |
|
1200 |
+ nnoremap ]oe :setlocal conceallevel=<C-R>=&conceallevel == 2 ? 2 : &conceallevel + 1<CR><CR> |
|
1201 |
+ |
|
582 | 1202 |
"""" `tpope/vim-repeat` |
583 | 1203 |
GitAdd https://github.com/tpope/vim-repeat |
584 | 1204 |
|
1205 |
+ """" `inkarkat/vim-visualrepeat` |
|
1206 |
+ " NOTE: Requires <https://github.com/inkarkat/vim-ingo-library> |
|
1207 |
+ GitAdd https://github.com/inkarkat/vim-visualrepeat |
|
1208 |
+ |
|
585 | 1209 |
"""" `tpope/vim-characterize` |
586 | 1210 |
GitAdd https://github.com/tpope/vim-characterize |
587 | 1211 |
|
... | ... |
@@ -596,26 +1220,56 @@ if has('eval') |
596 | 1220 |
map g# <Plug>(asterisk-g#) |
597 | 1221 |
map <silent> z* <Plug>(asterisk-z*): set hlsearch<CR> |
598 | 1222 |
map <silent> z# <Plug>(asterisk-z#): set hlsearch<CR> |
599 |
- map <silent> zg* <Plug>(asterisk-gz*):set hlsearch<CR> |
|
600 |
- map <silent> zg# <Plug>(asterisk-gz#):set hlsearch<CR> |
|
1223 |
+ map <silent> gz* <Plug>(asterisk-gz*):set hlsearch<CR> |
|
1224 |
+ map <silent> gz# <Plug>(asterisk-gz#):set hlsearch<CR> |
|
601 | 1225 |
|
602 | 1226 |
"""" `AndrewRadev/splitjoin.vim` |
603 | 1227 |
GitAdd https://github.com/AndrewRadev/splitjoin.vim |
604 | 1228 |
|
1229 |
+ " TODO: According to |splitjoin_align| this requires either of the Tabular or |
|
1230 |
+ " Align plugins. We currently prefer vim-lion. Create a pull request? |
|
1231 |
+ " let g:splitjoin_align = 1 |
|
1232 |
+ |
|
605 | 1233 |
"""" `AndrewRadev/switch.vim` |
606 | 1234 |
GitAdd https://github.com/AndrewRadev/switch.vim |
607 | 1235 |
|
608 | 1236 |
let g:switch_custom_definitions = [{ |
609 | 1237 |
\ '\<0\>': '1', |
610 | 1238 |
\ '\<1\>': '0', |
611 |
- \ '\(\w*\)TRUE\(\w*\)': '\1FALSE\2', |
|
612 |
- \ '\(\w*\)True\(\w*\)': '\1False\2', |
|
613 |
- \ '\(\w*\)true\(\w*\)': '\1false\2', |
|
1239 |
+ \ '\<OFF\>': 'ON', |
|
1240 |
+ \ '\<Off\>': 'On', |
|
1241 |
+ \ '\<off\>': 'on', |
|
1242 |
+ \ '\<ON\>': 'OFF', |
|
1243 |
+ \ '\<On\>': 'Off', |
|
1244 |
+ \ '\<on\>': 'off', |
|
1245 |
+ \ '\<NO\>': 'YES', |
|
1246 |
+ \ '\<No\>': 'Yes', |
|
1247 |
+ \ '\<no\>': 'yes', |
|
1248 |
+ \ '\<YES\>': 'NO', |
|
1249 |
+ \ '\<Yes\>': 'No', |
|
1250 |
+ \ '\<yes\>': 'no', |
|
614 | 1251 |
\ '\(\w*\)FALSE\(\w*\)': '\1TRUE\2', |
615 | 1252 |
\ '\(\w*\)False\(\w*\)': '\1True\2', |
616 | 1253 |
\ '\(\w*\)false\(\w*\)': '\1true\2', |
1254 |
+ \ '\(\w*\)TRUE\(\w*\)': '\1FALSE\2', |
|
1255 |
+ \ '\(\w*\)True\(\w*\)': '\1False\2', |
|
1256 |
+ \ '\(\w*\)true\(\w*\)': '\1false\2', |
|
1257 |
+ \ '\<\(set *\)no\([a-z]\+\)\>=\@!': '\1\2', |
|
1258 |
+ \ '\<\(set *\)\([a-z]\+\)\>=\@!': '\1no\2', |
|
617 | 1259 |
\ }] |
618 | 1260 |
|
1261 |
+ """" `terryma/vim-smooth-scroll` |
|
1262 |
+ " GitAdd https://github.com/terryma/vim-smooth-scroll |
|
1263 |
+ |
|
1264 |
+ " Kind of useful when pair programming to give some indication of navigation, |
|
1265 |
+ " mostly annoying when not. |
|
1266 |
+ |
|
1267 |
+ " Roughly as suggested in the readme. |
|
1268 |
+ " noremap <silent> <C-U> :call smooth_scroll#up( &scroll*1, 20, &scroll/4)<CR> |
|
1269 |
+ " noremap <silent> <C-D> :call smooth_scroll#down(&scroll*1, 20, &scroll/4)<CR> |
|
1270 |
+ " noremap <silent> <C-B> :call smooth_scroll#up( &scroll*2, 20, &scroll/2)<CR> |
|
1271 |
+ " noremap <silent> <C-F> :call smooth_scroll#down(&scroll*2, 20, &scroll/2)<CR> |
|
1272 |
+ |
|
619 | 1273 |
""" Insert mode |
620 | 1274 |
|
621 | 1275 |
"""" `tpope/vim-endwise` |
... | ... |
@@ -624,6 +1278,14 @@ if has('eval') |
624 | 1278 |
"""" `jiangmiao/auto-pairs` |
625 | 1279 |
GitAdd https://github.com/jiangmiao/auto-pairs |
626 | 1280 |
|
1281 |
+ " TODO: Look at "Swedish Character Conflict" in the documentation. |
|
1282 |
+ |
|
1283 |
+ " Disable meta mappings. |
|
1284 |
+ let g:AutoPairsShortcutToggle = '' |
|
1285 |
+ let g:AutoPairsShortcutFastWrap = '' |
|
1286 |
+ let g:AutoPairsShortcutJump = '' |
|
1287 |
+ let g:AutoPairsShortcutBackInsert = '' |
|
1288 |
+ |
|
627 | 1289 |
" Don't jump around too much. See |autopairs-options|. |
628 | 1290 |
let g:AutoPairsCenterLine = 0 |
629 | 1291 |
let g:AutoPairsMultilineClose = 0 |
... | ... |
@@ -631,7 +1293,7 @@ if has('eval') |
631 | 1293 |
""" Command-line mode |
632 | 1294 |
|
633 | 1295 |
"""" `tpope/vim-rsi` |
634 |
- GitAdd https://github.com/tpope/vim-rsi |
|
1296 |
+ " GitAdd https://github.com/tpope/vim-rsi |
|
635 | 1297 |
|
636 | 1298 |
"""" `tpope/vim-abolish` |
637 | 1299 |
GitAdd https://github.com/tpope/vim-abolish |
... | ... |
@@ -659,6 +1321,15 @@ if has('eval') |
659 | 1321 |
"""" `wellle/targets.vim` |
660 | 1322 |
GitAdd https://github.com/wellle/targets.vim |
661 | 1323 |
|
1324 |
+ " `targets` just pairs up quotes from the beginning of line, which is often |
|
1325 |
+ " not what we want (especially in shell scripts). |
|
1326 |
+ xnoremap i" i" |
|
1327 |
+ xnoremap i' i' |
|
1328 |
+ xnoremap i` i` |
|
1329 |
+ onoremap i" i" |
|
1330 |
+ onoremap i' i' |
|
1331 |
+ onoremap i` i` |
|
1332 |
+ |
|
662 | 1333 |
"""" `bkad/CamelCaseMotion` |
663 | 1334 |
GitAdd https://github.com/bkad/CamelCaseMotion |
664 | 1335 |
|
... | ... |
@@ -675,7 +1346,7 @@ if has('eval') |
675 | 1346 |
GitAdd https://github.com/kana/vim-textobj-user |
676 | 1347 |
|
677 | 1348 |
" All later plugins in the "Motions / text objects" category depend on this |
678 |
- " plugin. See https://github.com/kana/vim-textobj-user/wiki. |
|
1349 |
+ " plugin. See <https://github.com/kana/vim-textobj-user/wiki>. |
|
679 | 1350 |
|
680 | 1351 |
"""" `kana/vim-textobj-entire` |
681 | 1352 |
GitAdd https://github.com/kana/vim-textobj-entire |
... | ... |
@@ -715,17 +1386,17 @@ if has('eval') |
715 | 1386 |
""" Colors |
716 | 1387 |
|
717 | 1388 |
"""" `gruvbox-community/gruvbox` |
1389 |
+ " TODO: This is a stopgap untill we make a Vim colorscheme from |
|
1390 |
+ " <https://notes/rcrnstn/colors.md>. |
|
718 | 1391 |
GitAdd https://github.com/gruvbox-community/gruvbox |
719 | 1392 |
|
720 | 1393 |
let g:gruvbox_contrast_dark = 'hard' |
721 | 1394 |
let g:gruvbox_invert_selection = 0 |
722 | 1395 |
|
723 |
- " Earlier settings indicate whether we want a color scheme not based on |
|
724 |
- " terminal colors. '|termguicolors|' is reset further down if not supported. |
|
725 |
- if &t_Co >= 256 |
|
726 |
- set termguicolors |
|
727 |
- colorscheme gruvbox |
|
728 |
- endif |
|
1396 |
+ autocmd vimrc OptionSet termguicolors nested |
|
1397 |
+ \ execute 'colorscheme' &termguicolors ? 'gruvbox' : 'default' | |
|
1398 |
+ |
|
1399 |
+ doautocmd OptionSet termguicolors |
|
729 | 1400 |
|
730 | 1401 |
""" Windows |
731 | 1402 |
|
... | ... |
@@ -741,8 +1412,10 @@ if has('eval') |
741 | 1412 |
set foldtext=unobtrusive_fold#text() |
742 | 1413 |
|
743 | 1414 |
" As suggested in |unobtrusive-fold-example|. |
744 |
- autocmd vimrc FileType * UnobtrusiveFoldComment |
|
745 |
- autocmd vimrc FileType markdown UnobtrusiveFoldChar # |
|
1415 |
+ " autocmd vimrc FileType * UnobtrusiveFoldComment |
|
1416 |
+ " autocmd vimrc FileType markdown UnobtrusiveFoldChar # |
|
1417 |
+ |
|
1418 |
+ let g:vim_markdown_folding_disabled = 1 |
|
746 | 1419 |
|
747 | 1420 |
""" Undo |
748 | 1421 |
|
... | ... |
@@ -757,30 +1430,79 @@ if has('eval') |
757 | 1430 |
""" QuickFix |
758 | 1431 |
|
759 | 1432 |
"""" Built-in `cfilter` |
760 |
- |
|
761 | 1433 |
packadd! cfilter |
762 | 1434 |
|
1435 |
+ """" `romainl/vim-qf` |
|
1436 |
+ " GitAdd https://github.com/romainl/vim-qf |
|
1437 |
+ |
|
1438 |
+ " let g:qf_mapping_ack_style = 1 |
|
1439 |
+ " let g:qf_shorten_path = 1 |
|
1440 |
+ |
|
1441 |
+ " TODO: Check if this causes problems, see the "Open the QuickFix/Location |
|
1442 |
+ " list window" section. |
|
1443 |
+ " let g:qf_auto_open_quickfix = 0 |
|
1444 |
+ |
|
1445 |
+ """ Spell |
|
1446 |
+ |
|
1447 |
+ """" `inkarkat/vim-SpellCheck` |
|
1448 |
+ " NOTE: Requires <https://github.com/inkarkat/vim-ingo-library> |
|
1449 |
+ " GitAdd https://github.com/inkarkat/vim-SpellCheck |
|
1450 |
+ |
|
763 | 1451 |
""" Modelines |
764 | 1452 |
|
765 | 1453 |
"""" `ypcrts/securemodelines` |
766 |
- GitAdd https://github.com/ypcrts/securemodelines |
|
1454 |
+ " GitAdd https://github.com/ypcrts/securemodelines |
|
1455 |
+ " TODO: Last updated 2019 as of writing, can we be sure is this really more |
|
1456 |
+ " secure than the built-in sandbox? Besides, we don't use modelines much |
|
1457 |
+ " anyway. |
|
1458 |
+ |
|
1459 |
+ " let g:secure_modelines_verbose = 1 |
|
767 | 1460 |
|
768 | 1461 |
""" Environment interaction |
769 | 1462 |
|
770 | 1463 |
"""" Built-in `netrw` |
771 | 1464 |
|
1465 |
+ let g:netrw_home = '~/.cache/vim/netrw' |
|
1466 |
+ let g:netrw_banner = 0 |
|
1467 |
+ |
|
772 | 1468 |
" Netrw versions (roughly) 162h to 170 break `gx`. Never download the remote |
773 | 1469 |
" file to a temporary. See |
774 |
- " - https://github.com/vim/vim/issues/1386 |
|
775 |
- " - https://github.com/vim/vim/issues/4738 |
|
776 |
- " - https://github.com/vim/vim/pull/7188 |
|
1470 |
+ " - <https://github.com/vim/vim/issues/1386> |
|
1471 |
+ " - <https://github.com/vim/vim/issues/4738> |
|
1472 |
+ " - <https://github.com/vim/vim/pull/7188> |
|
777 | 1473 |
let g:netrw_nogx = 1 |
778 | 1474 |
nnoremap <silent> gx :call netrw#BrowseX(netrw#GX(), 0)<CR> |
779 | 1475 |
xnoremap <silent> gx y:call netrw#BrowseX(@", 0)<CR> |
780 | 1476 |
|
1477 |
+ """" `bogado/file-line` |
|
1478 |
+ GitAdd https://github.com/bogado/file-line |
|
1479 |
+ |
|
781 | 1480 |
"""" `ctrlpvim/ctrlp.vim` |
782 | 1481 |
GitAdd https://github.com/ctrlpvim/ctrlp.vim |
783 | 1482 |
|
1483 |
+ " <https://github.com/kien/ctrlp.vim/issues/337> |
|
1484 |
+ " <https://github.com/ctrlpvim/ctrlp.vim/pull/316> |
|
1485 |
+ " <https://github.com/ctrlpvim/ctrlp.vim/issues/450> |
|
1486 |
+ " NOTE: Highly dependent on non-documented ctrlp internals. |
|
1487 |
+ function! s:ctrlp_syntax() abort |
|
1488 |
+ execute 'autocmd vimrc OptionSet cursorline' |
|
1489 |
+ \ 'if winnr() == ' winnr() ' && &cursorline |' |
|
1490 |
+ \ ' set nocursorline |' |
|
1491 |
+ \ 'endif |' |
|
1492 |
+ syntax region CtrlPLine start="^" end="$" |
|
1493 |
+ syntax region CtrlPLineSel start="\%#" end="$" |
|
1494 |
+ highlight! link CtrlPLine Comment |
|
1495 |
+ highlight! link CtrlPLineSel Normal |
|
1496 |
+ " TODO: `&term ==# 'linux'` does not do `underline`. |
|
1497 |
+ highlight CtrlPPrtCursor term=underline cterm=underline |
|
1498 |
+ endfunction |
|
1499 |
+ " We need to define the `Syntax` `autocmd` after `ctrlp` has been loaded, but |
|
1500 |
+ " also when we reload the `vimrc`. |
|
1501 |
+ " TODO: This still does not work when reloading the `vimrc`. |
|
1502 |
+ autocmd vimrc VimEnter * |
|
1503 |
+ \ autocmd vimrc Syntax ctrlp call s:ctrlp_syntax() |
|
1504 |
+ autocmd vimrc Syntax ctrlp call s:ctrlp_syntax() |
|
1505 |
+ |
|
784 | 1506 |
let g:ctrlp_working_path_mode = '' |
785 | 1507 |
let g:ctrlp_match_current_file = 1 |
786 | 1508 |
let g:ctrlp_follow_symlinks = 2 |
... | ... |
@@ -791,33 +1513,76 @@ if has('eval') |
791 | 1513 |
let g:ctrlp_use_readdir = 0 " Respect 'wildignore'. |
792 | 1514 |
let g:ctrlp_max_files = 0 " Default 10000. |
793 | 1515 |
let g:ctrlp_max_depth = 40 " Default 40. |
1516 |
+ let g:ctrlp_match_window = 'max:20' " Default 'max:10' |
|
794 | 1517 |
" let g:ctrlp_user_command_async = 1 |
795 | 1518 |
if has('unix') |
796 | 1519 |
" TODO: Set `grepprg` to something similar, that skips things in |
797 | 1520 |
" 'wildignore'. |
798 |
- let g:ctrlp_user_command = 'find' . |
|
799 |
- \ (g:ctrlp_follow_symlinks ? ' -L' : '') . |
|
1521 |
+ let s:wildignore = split(&wildignore, ',') |
|
1522 |
+ let s:wildignore_name = filter(copy(s:wildignore), '!count(v:val, "/")') |
|
1523 |
+ let s:wildignore_path = filter(copy(s:wildignore), ' count(v:val, "/")') |
|
1524 |
+ |
|
1525 |
+ let g:ctrlp_user_command = |
|
1526 |
+ \ 'find' . |
|
1527 |
+ \ (!g:ctrlp_follow_symlinks ? '' : ' -L') . |
|
800 | 1528 |
\ ' %s' . |
1529 |
+ \ ' -mount' . |
|
801 | 1530 |
\ ' -maxdepth ' . g:ctrlp_max_depth . |
802 | 1531 |
\ ' \( -false' . |
803 | 1532 |
\ (g:ctrlp_show_hidden ? '' : ' -o -name ".*"') . |
804 |
- \ ' ' . |
|
805 |
- \ join(map(split(&wildignore, ','), '"-o -name " . shellescape(v:val)')) . |
|
1533 |
+ \ ' ' . join(map(s:wildignore_name, '"-o -name " . shellescape(v:val)')) . |
|
1534 |
+ \ ' ' . join(map(s:wildignore_path, '"-o -path " . shellescape(v:val)')) . |
|
806 | 1535 |
\ ' \) -prune -o' . |
807 |
- \ ' -type f' . |
|
1536 |
+ \ ' -type f -print' . |
|
808 | 1537 |
\ ' 2> /dev/null' . |
809 |
- \ (g:ctrlp_max_files ? ' | head -n ' . g:ctrlp_max_files : '') |
|
1538 |
+ \ (!g:ctrlp_max_files ? '' : ' | head -n ' . g:ctrlp_max_files) |
|
1539 |
+ |
|
1540 |
+ |
|
1541 |
+ " \ ' -type d -exec test -d {}/.git \; -prune -o' . |
|
810 | 1542 |
" \ ' -exec grep -Il . {} +' . |
811 | 1543 |
" \ ' \(' . |
812 | 1544 |
" \ (g:ctrlp_follow_symlinks == 2 ? ' -o -type l' : '') . |
813 | 1545 |
" \ ' \)' . |
1546 |
+ |
|
1547 |
+ " function! s:ctrl_find_prefix(prefix, list) abort |
|
1548 |
+ " return map(copy(a:list), '["' . a:prefix . '", shellescape(v:val)]') |
|
1549 |
+ " endfunction |
|
1550 |
+ " function! s:ctrl_find_join(join, list) abort |
|
1551 |
+ " return ['\('] + eval(join(a:list, '+["' . a:join . '"]+')) + ['\)'] |
|
1552 |
+ " endfunction |
|
1553 |
+ " let g:ctrlp_user_command = join( |
|
1554 |
+ " \ ['find', (!g:ctrlp_follow_symlinks ? '' : '-L'), '%s'] + |
|
1555 |
+ " \ ['-maxdepth', g:ctrlp_max_depth] + |
|
1556 |
+ " \ s:ctrl_find_join('-o', |
|
1557 |
+ " \ s:ctrl_find_prefix('-name', g:ctrlp_show_hidden ? [] : ['.*']) + |
|
1558 |
+ " \ s:ctrl_find_prefix('-name', s:wildignore_name) + |
|
1559 |
+ " \ s:ctrl_find_prefix('-path', s:wildignore_path) |
|
1560 |
+ " \ ) + ['-prune', '-o'] + |
|
1561 |
+ " \ ['-type', 'f', '-print'] + |
|
1562 |
+ " \ ['2>', '/dev/null'] + |
|
1563 |
+ " \ (!g:ctrlp_max_files ? [] : ['|', 'head', '-n', g:ctrlp_max_files]) |
|
1564 |
+ " \ ) |
|
1565 |
+ |
|
814 | 1566 |
endif |
815 | 1567 |
|
1568 |
+ """" `mhinz/vim-tree` |
|
1569 |
+ " GitAdd https://github.com/mhinz/vim-tree |
|
1570 |
+ |
|
1571 |
+ " As suggesteed in the readme. |
|
1572 |
+ " autocmd vimrc FileType tree |
|
1573 |
+ " \ setlocal foldmethod=expr |
|
1574 |
+ |
|
816 | 1575 |
"""" `tpope/vim-fugitive` |
817 | 1576 |
GitAdd https://github.com/tpope/vim-fugitive |
818 | 1577 |
|
819 | 1578 |
autocmd vimrc FileType fugitiveblame call fugitive#MapJumps() |
820 | 1579 |
|
1580 |
+ " http://vimcasts.org/episodes/fugitive-vim-browsing-the-git-object-database/ |
|
1581 |
+ " TODO: Do we want `bufhidden=wipe`? |
|
1582 |
+ autocmd vimrc BufReadPost fugitive://* setlocal bufhidden=delete |
|
1583 |
+ |
|
1584 |
+ " TODO: Add some `git log -L` (see man page) mapping. |
|
1585 |
+ |
|
821 | 1586 |
"""" `tommcdo/vim-fugitive-blame-ext` |
822 | 1587 |
GitAdd https://github.com/tommcdo/vim-fugitive-blame-ext |
823 | 1588 |
|
... | ... |
@@ -827,6 +1592,58 @@ if has('eval') |
827 | 1592 |
"""" `tpope/vim-dispatch` |
828 | 1593 |
GitAdd https://github.com/tpope/vim-dispatch |
829 | 1594 |
|
1595 |
+ " https://github.com/tpope/vim-dispatch/issues/203 |
|
1596 |
+ function! s:focus_start_set() abort |
|
1597 |
+ if get(b:, 'start_local', 1) |
|
1598 |
+ let b:start_local = get(b:, 'start') |
|
1599 |
+ endif |
|
1600 |
+ let b:start = s:start |
|
1601 |
+ endfunction |
|
1602 |
+ function! s:focus_start_unset() abort |
|
1603 |
+ if type(get(b:, 'start_local')) == type('') |
|
1604 |
+ let b:start = b:start_local |
|
1605 |
+ else |
|
1606 |
+ unlet! b:start |
|
1607 |
+ endif |
|
1608 |
+ unlet! b:start_local |
|
1609 |
+ endfunction |
|
1610 |
+ function! s:focus_start(bang, command) abort |
|
1611 |
+ if !empty(a:command) |
|
1612 |
+ let s:start = a:command |
|
1613 |
+ augroup vimrc_dispatch_start |
|
1614 |
+ autocmd! |
|
1615 |
+ augroup END |
|
1616 |
+ silent bufdo call s:focus_start_set() |
|
1617 |
+ augroup vimrc_dispatch_start |
|
1618 |
+ autocmd BufEnter * call s:focus_start_set() |
|
1619 |
+ augroup END |
|
1620 |
+ echo 'Set global default to :Start' s:start |
|
1621 |
+ elseif a:bang |
|
1622 |
+ unlet! s:start |
|
1623 |
+ augroup vimrc_dispatch_start |
|
1624 |
+ autocmd! |
|
1625 |
+ augroup END |
|
1626 |
+ silent bufdo call s:focus_start_unset() |
|
1627 |
+ if type(get(b:, 'start')) == type('') |
|
1628 |
+ echo 'Reverted default to :Start' b:start |
|
1629 |
+ else |
|
1630 |
+ echo 'Reverted default to :Start' |
|
1631 |
+ endif |
|
1632 |
+ else |
|
1633 |
+ if type(get(s:, 'start')) == type('') |
|
1634 |
+ echo 'Global focus is :Start' s:start |
|
1635 |
+ elseif type(get(b:, 'start')) == type('') |
|
1636 |
+ echo 'Buffer default is :Start' b:start |
|
1637 |
+ else |
|
1638 |
+ echo 'Global default is :Start' |
|
1639 |
+ endif |
|
1640 |
+ endif |
|
1641 |
+ endfunction |
|
1642 |
+ command! -bang -nargs=* -range=-1 -complete=customlist,dispatch#command_complete FocusStart |
|
1643 |
+ \ call s:focus_start(<bang>0, <q-args>) |
|
1644 |
+ |
|
1645 |
+ " TODO: Put this in a QuickFix section? |
|
1646 |
+ |
|
830 | 1647 |
" TODO: Stick to the default mappings. |
831 | 1648 |
nnoremap <Space><Space>m% :Make %:r:S<CR> |
832 | 1649 |
nnoremap <Space><Space>m# :Make #:r:S<CR> |
... | ... |
@@ -842,42 +1659,167 @@ if has('eval') |
842 | 1659 |
|
843 | 1660 |
""" Debugging |
844 | 1661 |
|
1662 |
+ """" Built-in `termdebug` |
|
1663 |
+ " See |terminal-debug|. |
|
1664 |
+ |
|
1665 |
+ packadd! termdebug |
|
1666 |
+ " TODO: Add mappings. |
|
1667 |
+ " TODO: Remove |:Winbar|. |
|
1668 |
+ " TODO: Do some |termdebug-customizing|, especially |termdebug_shortcuts|. |
|
1669 |
+ " TODO: Add some signs? ■♦←↑→↓›»•· |
|
1670 |
+ " let g:termdebug_popup = 0 |
|
1671 |
+ |
|
1672 |
+ nnoremap <Space>dd :Termdebug |
|
1673 |
+ |
|
1674 |
+ nnoremap <Space>db :Break<CR> |
|
1675 |
+ nnoremap <Space>dB :Clear<CR> |
|
1676 |
+ nnoremap <Space>di :Step<CR> |
|
1677 |
+ nnoremap <Space>do :Over<CR> |
|
1678 |
+ nnoremap <Space>df :Finish<CR> |
|
1679 |
+ nnoremap <Space>dr :Run<CR> |
|
1680 |
+ nnoremap <Space>da :Arguments<CR> |
|
1681 |
+ nnoremap <Space>ds :Stop<CR> |
|
1682 |
+ nnoremap <Space>dc :Continue<CR> |
|
1683 |
+ " nnoremap <Space>de :Evaluate<CR> |
|
1684 |
+ |
|
1685 |
+ " nnoremap <Space>dg :Gdb<CR> |
|
1686 |
+ " nnoremap <Space>ds :Source<CR> |
|
1687 |
+ " nnoremap <Space>da :Asm<CR> |
|
1688 |
+ |
|
1689 |
+ " nnoremap <Space>dw :Winbar<CR> |
|
1690 |
+ |
|
845 | 1691 |
"""" `puremourning/vimspector` |
846 | 1692 |
" GitAdd https://github.com/puremourning/vimspector |
847 | 1693 |
|
848 | 1694 |
" Debug Adapter Protocol (DAP) client. See |
849 |
- " https://microsoft.github.io/debug-adapter-protocol/. |
|
1695 |
+ " - <https://microsoft.github.io/debug-adapter-protocol/> |
|
1696 |
+ " - <https://sourceware.org/gdb/current/onlinedocs/gdb.html/Debugger-Adapter-Protocol.html> |
|
1697 |
+ |
|
1698 |
+ " <https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation> |
|
850 | 1699 |
|
851 | 1700 |
"""" `vim-vdebug/vdebug` |
852 | 1701 |
" GitAdd https://github.com/vim-vdebug/vdebug |
853 | 1702 |
|
1703 |
+ " Supports PHP, Python, Ruby, Perl, Tcl and NodeJS. |
|
1704 |
+ |
|
854 | 1705 |
" Common DeBugGer Protocol (DBGP) client. See |
855 |
- " https://en.wikipedia.org/wiki/DBGp. |
|
1706 |
+ " <https://en.wikipedia.org/wiki/DBGp>. |
|
856 | 1707 |
|
857 |
-endif "" has('eval') |
|
1708 |
+endif " has('eval') |
|
858 | 1709 |
|
859 | 1710 |
"" Syntax and file type |
1711 |
+if has('gui_running') |
|
1712 |
+ " See |'background'|. |
|
1713 |
+ " TODO: Causes the GUI cursor to be misplaced? |
|
1714 |
+ " gui |
|
1715 |
+endif |
|
860 | 1716 |
if has('eval') |
861 |
- syntax enable |
|
862 | 1717 |
filetype plugin indent on |
1718 |
+ syntax enable |
|
1719 |
+endif |
|
1720 |
+ |
|
1721 |
+"" File type detection |
|
1722 |
+" See |new-filetype|. |
|
1723 |
+ |
|
1724 |
+if has('eval') |
|
1725 |
+ |
|
1726 |
+ autocmd! filetypedetect BufRead,BufNewFile *.Xresources setf xdefaults |
|
1727 |
+ autocmd! filetypedetect BufRead,BufNewFile *.gdb*init setf gdb |
|
1728 |
+ autocmd! filetypedetect BufRead,BufNewFile *.asy setf cpp |
|
1729 |
+ autocmd! filetypedetect BufRead,BufNewFile *.gvpr setf c |
|
1730 |
+ |
|
1731 |
+endif |
|
1732 |
+ |
|
1733 |
+"" Language specific |help| |
|
1734 |
+ |
|
1735 |
+if has('eval') |
|
1736 |
+ function! s:help(cmd, arg, filetype) abort |
|
1737 |
+ for i in range(len(a:cmd)) |
|
1738 |
+ let a:cmd[i] = join( |
|
1739 |
+ \ map(split(a:cmd[i], '%s', 1), 'shellescape(v:val)'), |
|
1740 |
+ \ shellescape(a:arg) |
|
1741 |
+ \ ) |
|
1742 |
+ endfor |
|
1743 |
+ silent help |
|
1744 |
+ silent let old_shellredir = &shellredir |
|
1745 |
+ silent let &shellredir = '>' |
|
1746 |
+ silent setlocal buftype=nofile bufhidden=delete noswapfile |
|
1747 |
+ silent setlocal noreadonly modifiable |
|
1748 |
+ silent execute 'file' a:arg |
|
1749 |
+ silent keepjumps normal! ggdG |
|
1750 |
+ silent execute 'read' '!' join(a:cmd) |
|
1751 |
+ silent keepjumps normal! ggdd |
|
1752 |
+ silent execute 'setlocal' 'filetype=' . a:filetype |
|
1753 |
+ silent setlocal readonly nomodifiable nomodified |
|
1754 |
+ silent setlocal buftype=help |
|
1755 |
+ silent let &shellredir = old_shellredir |
|
1756 |
+ endfunction |
|
863 | 1757 |
endif |
864 | 1758 |
|
1759 |
+command! -nargs=1 -complete=shellcmd ManHelp |
|
1760 |
+\ call s:help(['man', '%s'], <q-args>, 'man') |
|
1761 |
+ |
|
1762 |
+command! -nargs=1 PythonHelp |
|
1763 |
+\ call s:help(['python3', '-m', 'pydoc', '%s'], <q-args>, 'python') |
|
1764 |
+ |
|
1765 |
+command! -nargs=1 OctaveHelp |
|
1766 |
+\ call s:help(['octave', '--eval', 'help("%s")'], <q-args>, 'octave') |
|
1767 |
+ |
|
1768 |
+" TODO: Would be cool to define one for `filetype` `gitconfig` that does |
|
1769 |
+" `ManHelp git-config` and then `/^ {7}\zs` whith the first two components of |
|
1770 |
+" setion words and `<cowrd>`. |
|
1771 |
+ |
|
865 | 1772 |
"" File type overrides |
866 | 1773 |
|
1774 |
+autocmd vimrc FileType * |
|
1775 |
+\ setlocal keywordprg=:ManHelp | |
|
1776 |
+ |
|
1777 |
+" TODO: This needs work. We globally override `fillchars` `stl`/`stlnc` and |
|
1778 |
+" `statusline` but don't take into account file type plugins setting their own |
|
1779 |
+" `statusline`. |
|
1780 |
+" TODO: `w:quickfix_title` is not always defined (e.g. when openging the |
|
1781 |
+" quickfix list when it has not been populated). Guard the printing in some |
|
1782 |
+" way? |
|
1783 |
+autocmd vimrc FileType qf |
|
1784 |
+\ setlocal statusline=%{Statusline()} | |
|
1785 |
+autocmd vimrc FileType help |
|
1786 |
+\ setlocal statusline=%{Statusline()} | |
|
1787 |
+ |
|
867 | 1788 |
autocmd vimrc FileType vim |
868 |
-\ setlocal keywordprg=:help formatoptions-=r |
|
1789 |
+\ setlocal keywordprg=:help | |
|
1790 |
+ |
|
1791 |
+autocmd vimrc FileType sh |
|
1792 |
+\ setlocal shiftwidth=2 | |
|
1793 |
+ |
|
1794 |
+autocmd vimrc FileType c,cpp,glsl |
|
1795 |
+\ setlocal commentstring=//\ %s | |
|
1796 |
+\ setlocal matchpairs=(:),{:},[:],<:> | |
|
1797 |
+\ setlocal cinkeys-=0# cinoptions=L0,l1,g0,N-s,E-s,t0,c0,C1,(s,u0,W1s,m1,j1,J1,N999,*999 | |
|
1798 |
+\ setlocal path=.,**/include,**/src,/usr/include,/usr/local/include,/usr/include/c++/11 | |
|
869 | 1799 |
|
870 |
-autocmd vimrc FileType c,cpp |
|
871 |
-\ setlocal commentstring=//\ %s |
|
1800 |
+autocmd vimrc FileType man |
|
1801 |
+\ setlocal nolist nospell | |
|
1802 |
+\ execute 'nnoremap <buffer> <Space>/ /^ \{4,\}\(--\S\+\, \)\?\zs-' | |
|
872 | 1803 |
|
873 | 1804 |
autocmd vimrc FileType dot |
874 |
-\ setlocal commentstring=//\ %s |
|
1805 |
+\ setlocal commentstring=//\ %s | |
|
1806 |
+ |
|
1807 |
+autocmd vimrc FileType gitcommit |
|
1808 |
+\ setlocal nolist spell | |
|
875 | 1809 |
|
876 | 1810 |
autocmd vimrc FileType markdown |
877 |
-\ setlocal complete+=kspell |
|
1811 |
+\ setlocal spell complete+=kspell | |
|
1812 |
+" \ setlocal formatoptions-=q | |
|
878 | 1813 |
|
879 |
-autocmd vimrc FileType man |
|
880 |
-\ setlocal nolist nospell |
|
1814 |
+autocmd vimrc FileType python |
|
1815 |
+\ setlocal keywordprg=:PythonHelp | |
|
1816 |
+ |
|
1817 |
+autocmd vimrc FileType octave |
|
1818 |
+\ setlocal keywordprg=:OctaveHelp | |
|
1819 |
+ |
|
1820 |
+" Don't insert comment leader after |i_<CR>|, |o|, or |O|. |
|
1821 |
+autocmd vimrc FileType * |
|
1822 |
+\ setlocal formatoptions-=r formatoptions-=o | |
|
881 | 1823 |
|
882 | 1824 |
" As suggested in |ft-syntax-omni|, use syntax completion if no other |
883 | 1825 |
" completion has been defined. |
... | ... |
@@ -886,6 +1828,9 @@ autocmd vimrc FileType * |
886 | 1828 |
\ setlocal omnifunc=syntaxcomplete#Complete | |
887 | 1829 |
\ endif | |
888 | 1830 |
|
1831 |
+" TODO: Add a match for `\<TODO\>` (and `\<NOTE\>`?) unconditionally for all |
|
1832 |
+" file types. |
|
1833 |
+ |
|
889 | 1834 |
"" Terminal overrides |
890 | 1835 |
" See |terminal-options|. |
891 | 1836 |
|
... | ... |
@@ -895,42 +1840,50 @@ autocmd vimrc FileType * |
895 | 1840 |
|
896 | 1841 |
if has('cursorshape') |
897 | 1842 |
set noshowmode |
898 |
- let &t_vi = '' |
|
899 |
- let &t_ve = "\<Esc>[?25h" |
|
1843 |
+ " Cursor visible/invisible |
|
1844 |
+ " On Linux the following is the default, which messes with our cursor |
|
1845 |
+ " shape: |
|
1846 |
+ " - `t_ve = "\033[?25h\033[?0c"` |
|
1847 |
+ " - `t_vi = "\033[?25l\033[?1c"` |
|
1848 |
+ " See |
|
1849 |
+ " - <https://vt100.net/docs/vt510-rm/DECTCEM> |
|
1850 |
+ " - `console_codes(4)` |
|
1851 |
+ let &t_ve = "\033[?25h" |
|
1852 |
+ let &t_vi = "\033[?25l" |
|
900 | 1853 |
" if $TERM =~? '^xterm\(-\|$\)' |
901 | 1854 |
" See |
902 |
- " - https://vt100.net/docs/vt510-rm/DECSCUSR |
|
903 |
- " - http://invisible-island.net/xterm/ctlseqs/ctlseqs.html |
|
904 |
- let &t_EI = "\<Esc>[1 q" |
|
905 |
- let &t_SI = "\<Esc>[5 q" |
|
906 |
- let &t_SR = "\<Esc>[3 q" |
|
907 |
- let &t_SH = "\<Esc>[%p1%d q" |
|
1855 |
+ " - <https://vt100.net/docs/vt510-rm/DECSCUSR> |
|
1856 |
+ " - `:helpgrep t_SH` |
|
1857 |
+ let &t_EI = "\033[1 q" |
|
1858 |
+ let &t_SI = "\033[5 q" |
|
1859 |
+ let &t_SR = "\033[3 q" |
|
1860 |
+ let &t_SH = "\033[%p1%d q" |
|
908 | 1861 |
" endif |
909 | 1862 |
if $TERM =~? '^linux\(-\|$\)' |
910 | 1863 |
" See |
911 |
- " - https://www.kernel.org/doc/Documentation/admin-guide/vga-softcursor.rst |
|
912 |
- let &t_EI = "\<Esc>[?8c" |
|
913 |
- let &t_SI = "\<Esc>[?2c" |
|
914 |
- let &t_SR = "\<Esc>[?2c" |
|
915 |
- let &t_SH = "\<Esc>[?%?%p1%{3}%<%t%{8}%e%{2}%;%dc" |
|
1864 |
+ " - <https://www.kernel.org/doc/Documentation/admin-guide/vga-softcursor.rst> |
|
1865 |
+ " - `console_codes(4)` |
|
1866 |
+ let &t_EI = "\033[?6c" |
|
1867 |
+ let &t_SI = "\033[?2c" |
|
1868 |
+ let &t_SR = "\033[?2c" |
|
1869 |
+ let &t_SH = "\033[?%?%p1%{3}%<%t%{6}%e%{2}%;%dc" |
|
916 | 1870 |
endif |
917 | 1871 |
endif |
918 | 1872 |
|
919 | 1873 |
""" True-color |
920 | 1874 |
" See |xterm-true-color|. |
921 | 1875 |
|
922 |
-if has('termguicolors') |
|
923 |
- " See https://github.com/termstandard/colors#truecolor-detection. |
|
924 |
- if empty($COLORTERM) && !has('vcon') |
|
925 |
- set notermguicolors |
|
926 |
- endif |
|
1876 |
+if has('termguicolors') && !has('nvim') |
|
927 | 1877 |
" These are the defaults if `$TERM` is `xterm`. |
928 |
- let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum" |
|
929 |
- let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum" |
|
930 |
- " Terminal window does not have transparent background when 'termguicolors' |
|
931 |
- " is used. See http://ftp.vim.org/pub/vim/patches/8.2/8.2.3516. |
|
1878 |
+ let &t_8f = "\033[38;2;%lu;%lu;%lum" |
|
1879 |
+ let &t_8b = "\033[48;2;%lu;%lu;%lum" |
|
1880 |
+ " <http://ftp.vim.org/pub/vim/patches/8.2/8.2.3516>: Terminal window does not |
|
1881 |
+ " have transparent background when 'termguicolors' is used. Fix the |
|
1882 |
+ " background color. |
|
932 | 1883 |
if !has('patch-8.2.3516') |
933 | 1884 |
let s:termguicolors = &termguicolors |
1885 |
+ autocmd vimrc OptionSet termguicolors |
|
1886 |
+ \ let s:termguicolors = &termguicolors |
|
934 | 1887 |
autocmd vimrc TerminalOpen,WinEnter * |
935 | 1888 |
\ let s:newtermguicolors = |
936 | 1889 |
\ s:termguicolors && |
... | ... |
@@ -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 | |
... | ... |
@@ -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. |
... | ... |
@@ -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 |
|
... | ... |
@@ -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 |
|
... | ... |
@@ -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 |
|
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 |