-
Notifications
You must be signed in to change notification settings - Fork 1
/
nvimrc.txt
556 lines (428 loc) · 25.4 KB
/
nvimrc.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
*nvimrc.txt* Neovim configuration as a self-bootstrapping plugin.
*nvimrc* 3.0.0
_ ~
_ ____ _(_)_ __ ___ _ __ ___ ~
| '_ \ \ / / | '_ ` _ \| '__/ __|~
| | | \ V /| | | | | | | | | (__ ~
|_| |_|\_/ |_|_| |_| |_|_| \___|~
~
==============================================================================
CONTENTS *nvimrc-contents*
1.Intro....................................|nvimrc-intro|
1.1.Structure..........................|nvimrc-structure|
2.Settings.................................|nvimrc-settings|
2.1.Autocompletion settings............|nvimrc-settings-autocompletion|
2.2.Unite settings.....................|nvimrc-settings-autocompletion|
2.3.vimfiler settings..................|nvimrc-settings-vimfiler|
3.Mappings.................................|nvimrc-mappings|
3.1.Custom Neovim mappings.............|nvimrc-mappings-custom|
3.2.Plugin specific mappings...........|nvimrc-mappings-plugin|
i.About....................................|nvimrc-about|
ii.License.................................|nvimrc-license|
iii.Warranty...............................|nvimrc-warranty|
==============================================================================
1. Intro *nvimrc-intro*
This configuration system works as a meta-plugin:
all desired Neovim plugins are loaded from *plugins.vim* using vim-plug,
and any GUI specific options are set in `gui.vim`.
Overall configuration then follows a normal plugin structure.
This document concerns the details of this specific Neovim environment.
For installation instructions and development information, see
https://github.com/rxrc/nvimrc
------------------------------------------------------------------------------
1.1 Structure *nvimrc-structure*
All plugins are loaded in `plugins.vim` using vim-plug.
Some plugin settings must be set at plugin initialization.
Those settings are located at the bottom of `plugins.vim`.
All other settings are split into individual files organized
either by function or plugin.
Standard Neovim configuration is contained directly under `plugin`.
Plugin specific configuration is contained in a correspondingly
named `.vim` file in some (possible nested) directly under `plugin`.
Settings are grouped by plugin, or possibly by the function
of several interrelated plugins.
The `plugin/mappings` directory is reserved for mappings.
The `plugin/autocompletion` directory contains file type specific
autocompletion configuration.
Use of `autocmd` within `augroup` is preferred where possible over `ftplugin`
in order to group related configuration by plugin instead of file type.
Use of `ftplugin` is preferred only for native Neovim settings.
==============================================================================
2. Settings *nvimrc-settings*
This section provides an overview of Neovim and plugin configuration choices.
A general feature and usage overview is given below.
Plugins with more involved configurations are given their own subsection.
Environment
- Persistent undo history enabled.
- Loads local spellfile `.spellfile.utf-8.add`.
Use `:Mklocalspell` to create or update the local spellfile.
- Uses `$VIM_BACKGROUND` to set `background`.
- Uses `$VIM_COLOR` to dynamically set airline theme.
- Uses `$VIM_LANG` to set spelling language. Defaults to `en_us`.
- Uses `$VIM_PYTHON` and `$VIM_PYTHON3` to set paths to python hosts.
This is required to avoid conflicts with Python Virtual Environments.
Defaults to `/bin/python` and `/bin/python3`.
Editor
- Strips trailing whitespace on save.
- Use [fzf] for line, path, and dictionary completion.
------------------------------------------------------------------------------
2.1 Autocompletion settings *nvimrc-settings-autocompletion*
Autocompletion is handled by LSP Zero.
Mappings (not listed under |nvimrc-mappings|)
- <C-J> and <C-K> navigate the popup in either direction.
- <C-L> closes the popup (keep completion).
- <C-W> backspace word and closes the popup (cancel completion).
- <CR> closes the popup and exits insert mode (cancel completion).
- <Tab> and <S-Tab> navigates snippets.
------------------------------------------------------------------------------
2.2 Unite settings *nvimrc-settings-unite*
Unite will use ag, ack, or grep in that order.
Custom Unite buffer mappings
- <C-J> and <C-K> navigate lines in insert mode.
- <Esc> quits the buffer.
------------------------------------------------------------------------------
2.3 vimfiler settings *nvimrc-settings-vimfiler*
Custom vimfiler buffer mappings
- <C-J>, <C-L>, and <Space> are reset to normal
and do not use their standard vimfiler mappings.
- <Tab> toggles marks.
- <Space><Space> switches to the directory history.
- <C-R> redraws the screen.
==============================================================================
3. Mappings *nvimrc-mappings*
With minor exceptions, all mappings are defined in individual `.vim` files
under `plugin/mappings`.
Conventionally, plugin specific mappings go in a file named after
the corresponding plugin, e.g., `fzf.vim`.
Alternatively, mappings spanning several interrelated plugs may be
grouped under a single file, e.g., `autocompletion.vim` may
contain mappings for cmp, LuaSnip, etc.
(in which case the plugin names will appear in a comment if unspecified).
The special file `neovim.vim` is reserved for native Neovim mappings.
The remainder of this section documents mappings created or modified
by this plugin. For behavior, refer to either Neovim's or
the corresponding plugin's documentation.
A general overview is given below, while a complete reference
of all mappings is given in the following subsections.
Note: my keyboard maps `CapsLock` to `RCtrl` and `RCtrl` to `Esc`.
A mapping that depends on a plugin will contain the [Plugin Name]
in square brackets.
Critically different mappings
- <Leader> is set to <Space> and <LocalLeader> is \.
- Enter (or <Esc>) leaves insert mode.
<C-CR> leaves terminal insert mode.
- Use <C-CR> or <S-CR> to insert a newline (split the line)
in normal or insert mode. Always ends in insert mode.
- In insert mode, use <C-J> to split the line and <C-K> to unsplit it.
- In insert mode, <C-H> is <BS> and <BS> is <Left>, but <C-L> is <Right>.
- Enter opens command-line mode from normal or visual mode.
- <S-Esc> toggles the command-line window in normal or visual mode.
- U is mapped to redo and <C-R> is mapped to the original U key.
- q and Q provide single key mappings for ge and gE.
- <Tab> is mapped to q (since q is now mapped to ge).
- <C-Tab> navigates the jump list in reverse (<C-I>).
- ` and ' are swapped.
- & is remapped to reuse flags (synonym for `:&&`).
- [Cutlass] takes over m and M (<C-G> is mapped to M).
- : is the [Cutlass] substitution operator.
and <C-;> is the substitution operator for the system clipboard.
- [Sneak] takes over s and S.
- Marks are handled by [Signature] with <Leader>;.
Use <Leader>;; to toggle marks.
- Autocompletion with [LSP Zero]:
see |nvimrc-settings-autocompletion|.
Shortcuts for common functions
- <C-H>, <C-J>, <C-K>, and <C-L> move between splits,
move the cursor, scroll through history, and navigate popups.
They serve as general alternatives to the arrow keys when possible.
[Vim Tmux Navigator] implements split navigation.
- <C--> and <C-=> moves lines up and down with [unimpaired].
- Double tap <Leader> to toggle folds.
- Use <Tab><Tab> to record to `@q` and <C-Q> to playback `@q`.
- <Leader>o clears the highlighting until next search.
- <Leader>= inserts from the expression register.
- <Leader>p and <Leader>P paste from the system clipboard.
- <Leader>c{motion} yanks to the system clipboard,
<Leader>C yanks to end of line to the system clipboard,
and <Leader>cc yanks the current line to the system clipboard.
- <Leader>m{motion} deletes and yanks to the system clipboard,
<Leader>M deletes and yanks to end of line to the system clipboard,
and <Leader>mm deletes and yanks the current line to the system clipboard.
- <Leader>:, <Leader>/, and <Leader>? open the corresponding
command-line or search window.
- [Commentary]: toggle commenting with \\.
- [Emmet] leader is <C-O> and expander is <C-E>.
Shortcuts for windows, tabs, and splits
- <Leader>{hjkl} splits the window.
- <Leader>{HJKL} splits the frame.
- <Leader><Tab> opens a new tab and <Leader><S-Tab> closes the tab.
- <C-,> and <C-.> cycles through tabs.
Shortcuts for buffer manipulation
- <Leader><CR> is a synonym for `:quit`.
- <Leader>q is a synonym for `:quitall`.
- <Leader>Q is a synonym for `:quitall!`.
- <Leader>n is a synonym for `:enew`.
- <Leader>E is a synonym for `:edit!`.
- <Leader>s and <Leader>S are synonyms for `:update` and `:write!`.
- [Bbye]: close and force close buffers with <Leader>w and <Leader>W.
Interfaces
- Close the preview window with <Leader>xz.
- [togglelist]: toggle the quickfix list with <Leader>xx
and the location list with <Leader>xl.
- [neoterm]: <Leader><BS> opens a terminal.
- [test]: run tests with <Leader>R, <Leader>rr, <Leader>ra, and <Leader>rl.
Visit last test with <Leader>rg.
- [Grepper]: <Leader>A will search with Grepper.
- [ALE]: In normal mode, <Leader>+ will run `:ALEFix`.
- [Autoformat]: In visual mode, <Leader>+ will run `:Autoformat`.
- [fugitive] functions all begin with <Leader>g.
- [fzf] functions all begin with <Leader>f.
- [Unite] buffers are mapped to <Leader>{abey}.
See also |nvimrc-settings-unite|.
If [fzf] is installed, will prioritize over Unite for some buffers.
- [vimfiler]: open and focus with <Leader>i and toggle with <Leader>I.
- [Tagbar]: open and focus with <Leader>t and toggle with <Leader>T.
- [undotree]: open and focus with <Leader>u and toggle with <Leader>U.
- For some file types, <Leader>d and <Leader>D
will provide an interface to documentation lookup.
Mapped for [fireplace], and [ri].
Toggles
- yoa toggles [Rainbow Parentheses].
- yoe toggles [lexima] on the current buffer.
- yof toggles [Yoink] paste formatting.
- yom toggles the colorcolumn display.
- yoP toggles the <Leader>p, <Leader>P, and <Leader>c
mappings between using the `+` (default) and `*` registers.
- yoz toggles [Unicode] name or glyph completion.
- yoU toggles mappings between using [fzf] and [Unite].
------------------------------------------------------------------------------
3.1 Custom Neovim mappings *nvimrc-mappings-custom*
This section lists any standard Neovim mappings which this plugin remaps,
and any new mappings to existing Neovim functions.
All mappings are nonrecursive unless otherwise noted.
*yom*
yom Toggle system clipboard mappings between using
the + and * registers. See |<Leader>p|, |<Leader>P|,
and |<Leader>c|.
*yoP*
yoP Toggle display of colorcolumn.
*q*
q Mapped to the motion ge (recursive).
*Q*
Q Mapped to the motion gE (recursive).
*U*
U Mapped to <C-R> (redo).
*&*
& Synonym for `:&&`.
*'*
' Mapped to ` (` is swapped with ').
*`*
` Mapped to ' (` is swapped with ').
*<BS>*
<BS> Mapped to <Left> in insert mode.
*<CR>*
<CR> Exit insert mode via <Esc>. In normal
or visual mode, open command-line mode.
Otherwise this still behaves like <CR>.
While the command-line and search windows are open,
this still executes the selected command or search:
Use <Leader>: to open command-line mode
from these windows.
*<C-CR>*
<C-CR> Insert a newline in normal or insert mode.
Exit to normal mode from terminal.
*<S-CR>*
<S-CR> Insert a newline in normal or insert mode.
*<S-Esc>*
<S-Esc> In normal or visual mode, toggle opening
and closing the command-line window.
*<C-Tab>*
<C-Tab> Mapped to <C-I> (equivalent to <Tab>).
*<C-G>*
<C-G> Mapped to M.
*<C-H>*
<C-H> In command-line mode, move cursor one character left.
In insert mode, mapped to <BS>.
*<C-J>*
<C-J> In command-line mode, navigate history down.
In insert mode, splits the line.
*<C-K>*
<C-K> In command-line mode, navigate history up.
In insert mode, unsplits the line.
*<C-L>*
<C-L> In insert mode and command-line mode,
move cursor one character right
(or inserts completion from popup).
*<C-Q>*
<C-Q> Mapped to @q.
*<C-R>*
<C-R> Mapped to U.
*<Leader>c*
*<Leader>C*
*<Leader>cc*
<Leader>cc or Same as y, but use the system register +.
<Leader>C or <Leader>cc yanks the current line.
<Leader>c{motion} <Leader>C yanks to the end of line.
Can toggle between + and * registers using |yoP|.
*<Leader>q*
*<Leader>E*
<Leader>E Synonym for `:edit!`.
*<Leader>h* *<Leader>j*
*<Leader>k* *<Leader>l*
<Leader>{hjkl} Split the window in corresponding direction.
*<Leader>H* *<Leader>J*
*<Leader>K* *<Leader>L*
<Leader>{HJKL} Split the frame in corresponding direction.
*<Leader>m*
*<Leader>M*
*<Leader>mm*
<Leader>mm or Same as m, but move to the system register +.
<Leader>M or <Leader>mm moves the current line.
<Leader>m{motion} <Leader>M moves to the end of line.
Can toggle between + and * registers using |yoP|.
*<Leader>n*
<Leader>n Synonym for `:enew`.
*<Leader>o*
<Leader>o Synonym for `:nohlsearch`.
*<Leader>p* *<Leader>P*
<Leader>{pP} Same as p and P, but use the system register +.
Can toggle between + and * registers using |yoP|.
*<Leader>q*
<Leader>q Synonym for `:quitall`.
*<Leader>Q*
<Leader>Q Synonym for `:quitall!`.
*<Leader>s*
<Leader>s Synonym for `:update`.
*<Leader>S*
<Leader>S Synonym for `:write!`.
*<Leader>xz*
<Leader>xz Synonym for `:pclose`.
*<Leader>,*
<Leader>, Mapped to gT.
*<Leader>.*
<Leader>. Mapped to gt.
*<Leader>/*
<Leader>/ Mapped to q/.
*<Leader>:*
<Leader>: Mapped to q:.
*<Leader>=*
<Leader>= Synonym for `:put` `=`
*<Leader>?*
<Leader>? Mapped to q?.
*<Leader><CR>*
<Leader><CR> Synonym for `:quit`.
*<Leader><Leader>*
<Leader><Leader> Mapped to za.
*<Leader><Tab>*
<Leader><Tab> Open a new tab.
*<Leader><S-Tab>*
<Leader><S-Tab> Close the current tab.
------------------------------------------------------------------------------
3.2 Plugin specific mappings *nvimrc-mappings-plugin*
This section lists mappings to plugin specific functions,
and modifications to a plugin's normal provided mappings.
Each mapping's dependent plugin is prefixed
by the [Plugin Name] in square brackets.
*yoa*
yoa [Rainbow Parentheses] Synonym for `:RainbowToggle`.
*yoe*
yoe [lexima] Toggle lexima on current buffer.
*yof*
yof [Yoink] Toggle paste formatting.
*yoz*
yoz [Unicode] Toggle unicode name or glyph completion.
*yoU*
yoU [fzf] [Unite] Toggle between fzf and Unite.
*m* *M* *mm*
mm or [Cutlass] Move motion.
M or mm moves the current line.
m{motion} M moves to the end of line.
*:* *::*
: or [Cutlass] Substitution operator.
:: :: substitutes the entire line.
*\\*
\\ [Commentary] Mapped to gcc.
*<C-E>*
<C-E> [Emmet] In insert mode, emmet expander key.
*<C-G>* *<C-G><C-G>*
<C-G> or [Cutlass] Substitution operator for system clipboard.
<C-G><C-G> <C-G><C-G> substitutes the entire line.
*<C-O>*
<C-O> [Emmet] In insert mode, Emmet leader key.
*<C-->* *<C-+>*
<C--> [unimpaired] Move lines up and down.
<C-=>
*<Leader>a* *<Leader>b*
*<Leader>e* *<Leader>y*
<Leader>{abey} [Unite] Open a Unite.vim buffer:
[a]g (grep), [b]uffers, fil[e]s, or [y]anks.
[fzf] If installed, selectively use fzf instead.
*<Leader>d* *<Leader>D*
<Leader>{dD} [fireplace] Prompt to lookup documentation with
`:Doc` or `:FindDoc`.
[ri] Prompt to search for documentation:
result window split horizontally (d)
or vertically (D).
*<Leader>A*
<Leader>A [Grepper] Prompt to search with Grepper.
*<Leader>f*
<Leader>f{acdefhjklmqstv/} or
<Leader>f<Space> [fzf] Open a fzf search, e.g.,
<Leader>ff is a synonym for `:FzfFiles`.
Use <Leader>fm to lookup the other mappings.
*<Leader>g*
<Leader>g{abcdeghjklmrsw}
[fugitive] Synonyms for git wrapper commands.
Use <Leader>fm to lookup the other mappings.
*<Leader>i* *<Leader>I*
<Leader>{iI} [vimfiler] Focus vimfiler panel with i, toggle with I.
*<Leader>r*
*<Leader>R*
*<Leader>rr*
<Leader>rr or [test] Run tests: rr runs nearest, R runs file,
<Leader>R or ra runs all, rl runs last.
<Leader>r{agl} Use rg to return to the last test.
*<Leader>t* *<Leader>T*
<Leader>{tT} [Tagbar] Focus Tagbar panel with t, toggle with T.
*<Leader>u* *<Leader>U*
<Leader>{uU} [undotree] Focus undotree panel with u, toggle with U.
*<Leader>w* *<Leader>W*
<Leader>{wW} [Bbye] Close the buffer but not the window:
w is a synonym for `:Bdelete` and
W is a synonym for `:Bdelete!`.
*<Leader>xx*
*<Leader>xz*
<Leader>x{xz} [togglelist] Toggle the quickfi[x]
or [l]ocation list.
*<Leader>+*
<Leader>+ [ALE] In normal mode, synonym for :ALEFix.
[Autoformat] In visual mode, synonym for `:Autoformat`.
*<Leader>;*
*<Leader>;;*
<Leader>;{signature-mapping} or
<Leader>;; [Signature] <Leader>; is the signature leader.
<Leader>;; will toggle marks (<Leader>;.).
*+Leader><BS>*
<Leader><BS> [neoterm] Synonym for `:Topen`.
==============================================================================
i. About *nvimrc-about*
This plugin is authored by Evan Sosenko.
Find the source and latest version at
https://github.com/rxrc/nvimrc
==============================================================================
ii. License *nvimrc-license*
This Neovim configuration is licensed under the MIT license.
https://github.com/rxrc/nvimrc/blob/master/LICENSE.txt.
==============================================================================
iii. Warranty *nvimrc-warranty*
This software is provided by the copyright holders and contributors "as is" and
any express or implied warranties, including, but not limited to, the implied
warranties of merchantability and fitness for a particular purpose are
disclaimed. In no event shall the copyright holder or contributors be liable for
any direct, indirect, incidental, special, exemplary, or consequential damages
(including, but not limited to, procurement of substitute goods or services;
loss of use, data, or profits; or business interruption) however caused and on
any theory of liability, whether in contract, strict liability, or tort
(including negligence or otherwise) arising in any way out of the use of this
software, even if advised of the possibility of such damage.
vim:tw=78:sw=4:ft=help:norl: