-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
executable file
·498 lines (471 loc) · 14 KB
/
.vimrc
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
" XXX: AVOID USING `autocmd` !!!
" :verbose set X to check detailed settings of variable X
" :help Y to check details of attribute Y
" ----------------
" vim-plug plugins
" ----------------
call plug#begin('~/.vim/additional_plugins')
">>>>>>>>>> ui themes <<<<<<<<<<
" molokai color scheme
Plug 'tomasr/molokai'
" airline status line
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" background dimming color scheme
Plug 'junegunn/limelight.vim',{'on':'Limelight'}
" multi-color bracket color scheme
Plug 'frazrepo/vim-rainbow'
" vertical line indent indicator
Plug 'Yggdroot/indentLine'
">>>>>>>>>> code auto-completers <<<<<<<<<<
" youcompleteme code auto-completer
Plug 'ycm-core/YouCompleteMe'
" snippet auto-completer
Plug 'SirVer/ultisnips'
" personal snippet repo
Plug 'honza/vim-snippets'
" github copilot online code completer
Plug 'github/copilot.vim'
">>>>>>>>>> vim checkers & linters & debuggers <<<<<<<<<<
" ale syntax checker
Plug 'dense-analysis/ale'
" in-vim debugger
Plug 'Shougo/vimproc.vim'
Plug 'idanarye/vim-vebugger'
">>>>>>>>>> editing helpers <<<<<<<<<<
" fast jump-to module
Plug 'easymotion/vim-easymotion'
" fast commentator
Plug 'scrooloose/nerdcommenter'
" auto bracket pairing module
Plug 'jiangmiao/auto-pairs'
" fast bracket adder
Plug 'tpope/vim-surround'
" copy & paste menu
Plug 'vim-scripts/YankRing.vim'
" undo visualizer
Plug 'mbbill/undotree'
" auto code aligner
Plug 'junegunn/vim-easy-align'
" plugin command repetition recorder with `.`
Plug 'tpope/vim-repeat'
">>>>>>>>>> file explorer <<<<<<<<<<
" filetree explorer engine
Plug 'preservim/nerdtree',{'on':'NERDTreeToggleVCS'}
" git indicators for nerdtree
Plug 'Xuyuanp/nerdtree-git-plugin',{'on':'NERDTreeToggleVCS'}
" filetype-specific highlighting for nerdtree
Plug 'tiagofumo/vim-nerdtree-syntax-highlight',{'on':'NERDTreeToggleVCS'}
" state preservation and restoration for nerdtree
Plug 'scrooloose/nerdtree-project-plugin',{'on':'NERDTreeToggleVCS'}
" current file highlighting and in-panel file closing for nerdtree
Plug 'PhilRunninger/nerdtree-buffer-ops',{'on':'NERDTreeToggleVCS'}
" visual mode for nerdtree
Plug 'PhilRunninger/nerdtree-visual-selection',{'on':'NERDTreeToggleVCS'}
">>>>>>>>>> extra functionalities <<<<<<<<<<
" global pattern / file fuzzy search engine
Plug 'Yggdroot/LeaderF',{'do':':LeaderfInstallCExtension','on':['Leaderf','LeaderfFile']}
" embedded terminal
Plug 'skywind3000/vim-terminal-help'
" semantic tag module
Plug 'liuchengxu/vista.vim'
" markdown preview visualizer
Plug 'suan/vim-instant-markdown'
" basic latex module
Plug 'lervag/vimtex',{'for':'tex'}
" latex preview visualizer
Plug 'xuhdev/vim-latex-live-preview',{'for':'tex'}
call plug#end()
" -------------------------------
" built-in variables & attributes
" -------------------------------
" language & encoding
language en_US.UTF-8
set encoding=utf8
" vi incompatibility
set nocompatible
" allowing background unsaved buffer
set hidden
" relative line number display with the current line number absolute
set number
set relativenumber
" file auto-reloading on external changes with checking interval 1000ms
set autoread
set updatetime=1000
" no backup / temp files
set nobackup
set nowritebackup
set noswapfile
" undo operation preservation with maximum 1000 history
set undofile
set history=1000
set undodir=~/.vim/.undo//
" current line highlighting
set cursorline
" vim command display on bottom-right
set showcmd
" cursor location display
set ruler
" matching bracket display
set showmatch
" case-insensitive auto-completion
set ignorecase
set infercase
set wildignorecase
" first-occurrence matching on every character input
set incsearch
" smart auto-indent with 4 <Space>s
set autoindent
set smartindent
set shiftwidth=4
" <Tab> to 4 <Space>s conversion in display
set tabstop=4
set expandtab
" trailing space highlighting
set list
set listchars=trail:\\u2588
" list:longest & full command line auto-completion
" first <Tab>: max common substring auto-completion with a candidate list
" second <Tab>: recursive selection
set wildmenu
set wildmode=list:longest,full
" forcing decimal in quick addition (<C-a>) / subtraction (<C-x>)
" conflicting with current settings
set nrformats=
" enabling mouse in normal and visual modes
set mouse=nv
" sign column for error and warning indicators
set signcolumn=yes
" a red column code length indicator
set colorcolumn=74
" line wrapping only on word separators
set linebreak
" multi-tabpage information line display
set showtabline=2
" command line height
set cmdheight=1
" disabling select mode
set selectmode=
" total occurrence count & current occurrence index display
set shortmess-=S
" code folding according to the indent level (off on startup)
set foldlevel=99
set foldmethod=indent
" auto-jumping into the root folder of the current file
set autochdir
" auto-complete menu display even if there is only one candidate
set completeopt=menu,menuone
" concealed text replaced with <Space>s
set conceallevel=1
" <Leader> key
let mapleader=','
" disabling matched bracket highlighting
let g:loaded_matchparen=1
" latex as the default tex filetype
let g:tex_flavor='latex'
" concealment for:
" a: accents & ligatures
" b: bolds & italics
" d: delimiters
" g: greek letters
" m: math symbols
" s: superscripts & subscripts
"let g:tex_conceal='abdgms'
let g:tex_conceal=''
" ----------------
" built-in keymaps
" ----------------
" exiting insert / visual modes
inoremap jk <Esc>
" fast tabpage switching
nnoremap <Tab> gt
" under-the-cursor file opening
nnoremap gf <C-w>gf
" fast jump-out-of-brackets
inoremap <C-Space> <Esc>la
" visual-line cursor moving & centering
nnoremap j gjzz
nnoremap k gkzz
" in-line character searching and jump-to
nnoremap <Space> f
" file opening in a new tabpage
nnoremap m :tabe<Space>
" file saving
nnoremap t :w<CR>
" file closing
nnoremap Q :q<CR>
" jumping to the start / end of lines
nnoremap W $
nnoremap B ^
" word selection & deletion & entering insert mode
nnoremap q viwc
" indent & outdent
nnoremap < <<
nnoremap > >>
" redo
nnoremap U <C-r>
" prefix for switching between panels
nnoremap <C-a> <C-w>
" occurrence replacing
" replacing `foo` with `bar`: :%s/foo/bar/gc
" g: global, c: confirmation with:
" y (replace and continue), n (skip and continue)
" a (replace all), q / <Esc> (quit) / l (replace and quit)
" <C-e> (scroll up) / <C-y> (scroll down)
nnoremap <C-h> :%s/
" -------
" molokai
" -------
" color scheme
colorscheme desert
" ----------------------------------
" vim-airline
" ----------------------------------
" | A | B | C X | Y | Z | W |
" ----------------------------------
" status line color scheme
let g:airline_theme='molokai'
" vista integrated into status line
let g:airline#extensions#vista#enabled=1
" ale integrated into status line
let g:airline#extensions#ale#enabled=1
" section c:
" F: absolute filepath
" m: modified flag
" r: readonly flag
" w: preview window flag
let g:airline_section_c='%F%m%r%w'
" section z:
" p: cursor relative location
" l: line index
" c: column index
let g:airline_section_z='%p%% L%l C%c'
" section w: blank
let g:airline_section_warning=''
" -------------
" limelight.vim
" -------------
" focus mode with dimmed context
nnoremap <Leader>d :Limelight!! 0.7<CR>
" -----------
" vim-rainbow
" -----------
" multi-color brackets enabled
let g:rainbow_active=1
" customized color scheme
let g:rainbow_guifgs=['RoyalBlue3','DarkOrange3','DarkOrchid3','FireBrick']
let g:rainbow_ctermfgs=['lightblue','red','lightgreen','yellow','magenta']
" ----------
" indentLine
" ----------
" no conceal mode in indentline
let g:indentLine_setConceal=0
" -------------
" YouCompleteMe
" -------------
" fast-jump to definition / declaration
nnoremap <c-]> :YcmCompleter GoToDefinitionElseDeclaration<CR>
" no floating window in completion
let g:ycm_auto_hover=''
" floating window for function / variable details
nnoremap <F4> <Plug>(YCMHover)
" single arbitrary character to trigger semantic auto-complete
let g:ycm_semantic_triggers={'python':['re!\w{1}']}
" ycm-driven semantic highlighting
let g:ycm_enable_semantic_highlighting=1
" in-line argument name display
let g:ycm_enable_inlay_hints=1
" no argument name display in insert mode
let g:ycm_clear_inlay_hints_in_insert_mode=1
" auto-completion in comments
let g:ycm_complete_in_comments=1
" auto-completion in strings
let g:ycm_complete_in_strings=1
" collecting identifiers from comments and strings
let g:ycm_collect_identifiers_from_comments_and_strings=1
" collecting identifiers from tag files
let g:ycm_collect_identifiers_from_tag_files=1
" external syntax database used for identifiers
let g:ycm_seed_identifiers_with_syntax=1
" no confirmation when using custom config file
let g:ycm_confirm_extra_conf=0
" compatibility with all omnifuncs with speed sacrifice
let g:ycm_cache_omnifunc=0
" minimum 1 characters to trigger auto-completion
let g:ycm_min_num_of_chars_for_completion=1
" ---------
" ultisnips
" ---------
" snippet auto-complete trigger
let g:UltiSnipsExpandTrigger='<c-f>'
" switching between to-be-filled parameter blanks
let g:UltiSnipsJumpForwardTrigger='<c-f>'
let g:UltiSnipsJumpBackwardTrigger='<c-b>'
let g:UltiSnipsEditSplit='vertical'
" single quotes for python snippets
let g:ultisnips_python_quoting_style='single'
let g:ultisnips_python_triple_quoting_style='single'
" ---
" ale
" ---
" activated fixers for all files
let g:ale_fixers=['prettier','eslint','trim_whitespace']
" activated fixers for python files
let g:ale_fixers={'python':['autoflake','autopep8','autoimport','pycln']}
" error and warning display on all problematic lines
let g:ale_virtualtext_cursor='all'
" signs for errors and warnings
let g:ale_sign_error='X'
let g:ale_sign_warning='!'
" module toggle
nnoremap <F6> :ALEToggle<CR>
" code auto-fixing
nnoremap <F7> :ALEFix<CR>
" fast jump to previous problematic line
nnoremap <C-k> :ALEPreviousWrap<CR>
" fast jump to next problematic line
nnoremap <C-j> :ALENextWrap<CR>
" ------------
" vim-vebugger
" ------------
" signals for breakpoints and current line in sign column
let g:vebugger_breakpoint_text='>'
let g:vebugger_currentline_text='@'
" in-vim PDB trigger
nnoremap <F5> :VBGstartPDB<Space>
">>>>>>>>>> hard-coded vebugger leader key <<<<<<<<<<
" breakpoint toggle at the current line
nnoremap `b :VBGtoggleBreakpointThisLine<CR>
" continue running to the next breakpoint
nnoremap `c :VBGcontinue<CR>
" stepping over the current line
nnoremap `<Space> :VBGstepOver<CR>
" stepping in the detailed implementation of the current line
nnoremap `i :VBGstepIn<CR>
" stepping out of the current detailed implementation
nnoremap `o :VBGstepOut<CR>
" querying a variable
nnoremap `e :VBGeval<Space>
" exiting PDB
nnoremap `q :VBGkill<Space>
" --------------
" vim-easymotion
" --------------
" bi-directional fast jump-to
nnoremap f <Plug>(easymotion-bd-f)
" -------------
" nerdcommenter
" -------------
" no <Space> added between the comment characters and the code
let g:NERDSpaceDelims=0
" compact multi-line comment style
let g:NERDCompactSexyComs=1
" trailing whitespace trimming when uncommenting a line
let g:NERDTrimTrailingWhitespace=1
" no default keymap loaded
let g:NERDCreateDefaultMappings=0
" commentation toggle in normal and visual modes
nnoremap <Leader>c <Plug>NERDCommenterToggle
vnoremap <Leader>c <Plug>NERDCommenterToggle
" ----------
" auto-pairs
" ----------
" function for auto-bracket-pairing
let &t_SI .= "\<Esc>[?2004h"
let &t_EI .= "\<Esc>[?2004l"
inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
function! XTermPasteBegin()
set pastetoggle=<Esc>[201~
set paste
return ''
endfunction
" ------------
" vim-surround
" ------------
" key + right bracket for surrounding bracket addition
nmap ( ysiw
" key + right bracket for surrounding bracket removal
nmap ) ds
" ------------
" YankRing.vim
" ------------
" maximum 50 items in history
let g:yankring_max_history=50
" history recording path
let g:yankring_history_dir='~/.vim/.yankring'
" yankring panel toggle
nnoremap <Leader>p :YRShow<CR>
" --------
" undotree
" --------
" panel toggle
nnoremap <Leader>u :UndotreeToggle<CR>
" --------------
" vim-easy-align
" --------------
" alignment trigger
vnoremap <Leader>a <Plug>(EasyAlign)
xnoremap <Leader>a <Plug>(EasyAlign)
" -------
" LeaderF
" -------
" fuzzy file searching
nnoremap <Leader>o :LeaderfFile<CR>
" fuzzy pattern matching
nnoremap <Leader>f :Leaderf rg<CR>
" -----------------
" vim-terminal-help
" -----------------
" in-vim terminal panel toggle
let g:terminal_key='<C-n>'
" ---------
" vista.vim
" ---------
" taglist panel toggle
nnoremap <F2> :Vista!!<CR>
" --------
" nerdtree
" --------
" panel toggle
noremap <F3> :NERDTreeToggleVCS<CR>
" panel size
let NERDTreeWinSize=40
" bookmark display in the panel
let NERDTreeShowBookmarks=1
" file panel closed after opening a file
" bookmark panel closed after opening a bookmark
let NERDTreeQuitOnOpen=3
" files omitted from the panel
let NERDTreeIgnore=['\.pyc$','\.pyo$','\.py\$class$','\.obj$','\.o$','\.so$','\.egg$','^\.git$','__pycache__','\.DS_Store']
" --------------------
" vim-instant-markdown
" --------------------
" re-rendering only after afk / leaving insert mode / saving
let g:instant_markdown_slow=1
" allowing script running behavior
let g:instant_markdown_allow_unsafe_content=1
" tex-style code rendering
let g:instant_markdown_mathjax=1
" port for rendering
let g:instant_markdown_port=8888
" ----------------------
" vim-latex-live-preview
" ----------------------
" pdf viewer for rendering
let g:livepreview_previewer='gv'
" re-rendering trigger
nnoremap <F12> :LLPStartPreview<CR>
" -----------------------------------
" auto commands (executed at startup)
" -----------------------------------
" auto-completion done by vim-integrated omnifunc
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType java set omnifunc=javacomplete#Complet
" python auto-completion done by youcompleteme
"autocmd FileType python set omnifunc=pythoncomplete#Complete
" ALE deactivated at startup
autocmd VimEnter * ALEToggle