-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc_unix
916 lines (783 loc) · 29.8 KB
/
vimrc_unix
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
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
"-- "plugin functions"
"----------------------------------------------------------------------------"
"-- "plugin pre-setting"
"--sheerun/vim-polyglot"
set nocompatible
"--easymotion/vim-easymotion"
let g:maplocalleader = ';'
"----------------------------------------------------------------------------"
call plug#begin('~/.vim/plugged')
"-- "completion or sources(like dict)"
Plug 'lervag/vimtex'
"Plug 'scrooloose/syntastic'
Plug 'neoclide/coc.nvim', {'branch':'release'}
"// coc.nvim source extensions
Plug 'tjdevries/coc-zsh'
Plug 'skywind3000/vim-dict'
"Plug 'wannesm/wmgraphviz.vim'
Plug 'liuchengxu/graphviz.vim'
Plug 'skywind3000/vim-auto-popmenu'
"++ vim snippets engine
Plug 'SirVer/ultisnips'
"++ vim input method
Plug 'ZSaberLv0/ZFVimIM'
Plug 'ZSaberLv0/ZFVimJob'
Plug 'ZSaberLv0/ZFVimGitUtil'
Plug 'RandolphChen/ZFVimIM_vimim-nature',{'branch':'origin/release'}
"Plug 'vim-scripts/VimIM'
"Plug 'dongyuwei/vimim-data'
"++ special char input
Plug 'Rykka/easydigraph.vim'
"-- "syntastic check"
Plug 'dense-analysis/ale'
"-- "syntax highlight"
Plug 'sheerun/vim-polyglot'
Plug 'sersorrel/vim-lilypond'
Plug 'luochen1990/rainbow'
Plug 'mechatroner/rainbow_csv'
"Plug 'yggdroot/indentline'
Plug 'nathanaelkane/vim-indent-guides'
"-- "code style or re-format"
Plug 'jiangmiao/auto-pairs'
Plug 'tpope/vim-surround'
Plug 'FooSoft/vim-argwrap'
Plug 'ntpeters/vim-better-whitespace'
Plug 'junegunn/vim-easy-align'
Plug 'godlygeek/tabular'
Plug 'preservim/tagbar'
"-- "move motion"
Plug 'easymotion/vim-easymotion'
Plug 'haya14busa/incsearch.vim'
Plug 'haya14busa/incsearch-easymotion.vim'
Plug 'haya14busa/incsearch-fuzzy.vim'
Plug 'haya14busa/incsearch-migemo.vim'
Plug 'ludovicchabant/vim-gutentags'
Plug 'Yggdroot/LeaderF', { 'do': ':LeaderfInstallCExtension' }
Plug 'kshenoy/vim-signature'
Plug 'mg979/vim-visual-multi'
"++ text object
Plug 'kana/vim-textobj-user'
Plug 'coderifous/textobj-word-column.vim'
Plug 'kana/vim-textobj-function'
Plug 'kana/vim-textobj-indent'
Plug 'glts/vim-textobj-comment'
Plug 'Julian/vim-textobj-variable-segment'
Plug 'kana/vim-textobj-line'
Plug 'rhysd/vim-textobj-anyblock'
Plug 'lucapette/vim-textobj-underscore'
Plug 'junegunn/vim-after-object'
Plug 'tweekmonster/braceless.vim'
Plug 'haya14busa/vim-easyoperator-phrase'
Plug 'haya14busa/vim-easyoperator-line'
Plug 'wellle/targets.vim'
"-- "projects or files"
Plug 'preservim/nerdtree'
Plug 'tpope/vim-classpath'
Plug 'embear/vim-localvimrc'
Plug 'tpope/vim-fugitive'
Plug 'preservim/tagbar'
"-- "tasks"
Plug 'Shougo/vimproc.vim', {'do' : 'make'}
"-- "debug"
"Plug 'puremourning/vimspector'
"Plug 'vim-vdebug/vdebug'
"-- "appearances or themes"
Plug 'morhetz/gruvbox'
Plug 'lifepillar/vim-gruvbox8'
Plug 'lifepillar/vim-colortemplate'
Plug 'lifepillar/vim-solarized8'
"Plug 'sainnhe/vim-color-forest-night'
"Plug 'kien/rainbow_parentheses.vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
"Plug 'ryanoasis/vim-devicons'
Plug 'edkolev/promptline.vim'
"++ UI
Plug 'skywind3000/quickmenu.vim'
Plug 'mhinz/vim-startify'
Plug 'liuchengxu/vim-which-key'
"-- "useful quick key mappings"
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-unimpaired'
"-- "use char to draw"
Plug 'gyim/vim-boxdraw'
Plug 'vim-scripts/DrawIt'
"-- "interesting tools"
call plug#end()
"----------------------------------------------------------------------------"
"-- "Plugin setting"
""-- "lifepillar/vim-solarized8"
"set background=dark
"colorscheme solarized8_high
"-- "lifepillar/vim-gruvbox8"
set termguicolors
let g:gruvbox8_contrast_dark='soft'
colorscheme gruvbox8
set background=dark
highlight Normal
"-- "morhetz/gruvbox"
"let g:gruvbox_contrast_dark = 'soft'
"colorscheme gruvbox
"set background=dark
"highlight Normal
"-- "skywind3000/vim-auto-popmenu"
" 设定需要生效的文件类型,如果是 "*" 的话,代表所有类型
let g:apc_enable_ft = {'text':1, 'markdown':1, 'php':1}
"let g:apc_enable_ft = {'*':1}
" 设定从字典文件以及当前打开的文件里收集补全单词,详情看 ':help cpt'
set cpt=.,k,w,b
" 不要自动选中第一个选项。
set completeopt=menu,menuone,noselect
" 禁止在下方显示一些啰嗦的提示
set shortmess+=c
""-- "scrooloose/syntastic"
"set statusline+=%#warningmsg#
"set statusline+=%{SyntasticStatuslineFlag()}
"set statusline+=%*
"let g:syntastic_always_populate_loc_list = 1
"let g:syntastic_auto_loc_list = 1
"let g:syntastic_check_on_open = 1
"let g:syntastic_check_on_wq = 0
""-- "zxqfl/tabnine-vim"
"""解决与scrooloose/syntastic的兼容性
""let g:ycm_show_diagnostics_ui = 0
"-- "easymotion/vim-easymotion" -: <localleader>
let g:EasyMotion_do_mapping = 0 " Disable default mappings
" <Leader>e{char} to move to {char}
map <localleader>e <Plug>(easymotion-bd-f)
nmap <localleader>e <Plug>(easymotion-overwin-f)
" s{char}{char} to move to {char}{char}
"nmap s <Plug>(easymotion-overwin-f2)
nmap s <Plug>(easymotion-overwin-f2)
" Move to line
map <localleader>L <Plug>(easymotion-bd-jk)
nmap <localleader>L <Plug>(easymotion-overwin-line)
" Move to word
map <localleader>w <Plug>(easymotion-bd-w)
nmap <localleader>w <Plug>(easymotion-overwin-w)
" hjkl motions
" EasyMotion can be configured to avoid repetitive use of the h j k and l keys.
map <localleader>l <Plug>(easymotion-lineforward)
map <localleader>j <Plug>(easymotion-j)
map <localleader>k <Plug>(easymotion-k)
map <localleader>h <Plug>(easymotion-linebackward)
let g:EasyMotion_startofline = 0 " keep cursor column when JK motion
" makes EasyMotion work similarly to Vim's smartcase option for global searches.
let g:EasyMotion_smartcase = 1
" Easymotion can match multibyte Japanese characters with alphabetical
" input.
let g:EasyMotion_use_migemo = 1
" Bidirectional & within line 't' motion
omap t <Plug>(easymotion-bd-tl)
omap f <Plug>(easymotion-bd-fl)
nmap t <Plug>(easymotion-bd-tl)
nmap f <Plug>(easymotion-bd-fl)
vmap t <Plug>(easymotion-bd-tl)
vmap f <Plug>(easymotion-bd-fl)
"-- "haya14busa/vim-easyoperator-line"
let g:EasyOperator_line_do_mapping = 0
omap <Leader>N <Plug>(easyoperator-line-select)
xmap <Leader>N <Plug>(easyoperator-line-select)
"-- "haya14busa/vim-easyoperator-phrase"
let g:EasyOperator_phrase_do_mapping = 0
omap <Leader>P <Plug>(easyoperator-phrase-select)
xmap <Leader>P <Plug>(easyoperator-phrase-select)
"-- "haya14busa/incsearch.vim"
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
" :h g:incsearch#auto_nohlsearch
set hlsearch
let g:incsearch#auto_nohlsearch = 1
map n <Plug>(incsearch-nohl-n)
map N <Plug>(incsearch-nohl-N)
map * <Plug>(incsearch-nohl-*)
map # <Plug>(incsearch-nohl-#)
map g* <Plug>(incsearch-nohl-g*)
map g# <Plug>(incsearch-nohl-g#)
"" :h incsearch-config-converters no regexp search
"function! s:noregexp(pattern) abort
" return '\V' . escape(a:pattern, '\')
"endfunction
"function! s:config() abort
" return {'converters': [function('s:noregexp')]}
"endfunction
"noremap <silent><expr> z/ incsearch#go(<SID>config())
"-- "haya14busa/incsearch-fuzzy.vim"
"" fuzzy search
"map z/ <Plug>(incsearch-fuzzy-/)
"map z? <Plug>(incsearch-fuzzy-?)
"map zg/ <Plug>(incsearch-fuzzy-stay)
"" fuzzyspell search; it uses spell feature in Vim
"map z/ <Plug>(incsearch-fuzzyspell-/)
"map z? <Plug>(incsearch-fuzzyspell-?)
"map zg/ <Plug>(incsearch-fuzzyspell-stay)
" Use both fuzzy & fuzzyspell feature
function! s:config_fuzzyall(...) abort
return extend(copy({
\ 'converters': [
\ incsearch#config#fuzzy#converter(),
\ incsearch#config#fuzzyspell#converter()
\ ],
\ }), get(a:, 1, {}))
endfunction
noremap <silent><expr> z/ incsearch#go(<SID>config_fuzzyall())
noremap <silent><expr> z? incsearch#go(<SID>config_fuzzyall({'command': '?'}))
noremap <silent><expr> zg? incsearch#go(<SID>config_fuzzyall({'is_stay': 1}))
"-- "haya14busa/incsearch-easymotion.vim"
" easymotion incsearch
map e/ <Plug>(incsearch-easymotion-/)
"map e? <Plug>(incsearch-easymotion-?)
"map eg/ <Plug>(incsearch-easymotion-stay)
" incsearch.vim x fuzzy x vim-easymotion
function! s:config_easyfuzzymotion(...) abort
return extend(copy({
\ 'converters': [incsearch#config#fuzzy#converter()],
\ 'modules': [incsearch#config#easymotion#module()],
\ 'keymap': {"\<CR>": '<Over>(easymotion)'},
\ 'is_expr': 0,
\ 'is_stay': 1
\ }), get(a:, 1, {}))
endfunction
noremap <silent><expr> <space>/ incsearch#go(<SID>config_easyfuzzymotion())
"-- "haya14busa/incsearch-migemo.vim"
map <leader>m/ <Plug>(incsearch-migemo-/)
map <leader>m? <Plug>(incsearch-migemo-?)
map <leader>mg/ <Plug>(incsearch-migemo-stay)
"-- "neoclide/coc.nvim" -: <space>c
" if hidden is not set, TextEdit might fail.
set hidden
"" Some servers have issues with backup files, see #649
"set nobackup
"set nowritebackup
" Better display for messages
set cmdheight=2
" You will have bad experience for diagnostic messages when it's default 4000.
set updatetime=300
" don't give |ins-completion-menu| messages.
set shortmess+=c
" always show signcolumns
set signcolumn=yes
" Use tab for trigger completion with characters ahead and navigate.
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
inoremap <silent><expr> <c-space> coc#refresh()
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
" Coc only does snippet and additional edit on confirm.
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Or use `complete_info` if your vim support it, like:
" inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
" Use `[g` and `]g` to navigate diagnostics
nmap <silent> <space>c[g <Plug>(coc-diagnostic-prev)
nmap <silent> <space>c]g <Plug>(coc-diagnostic-next)
" Remap keys for gotos
nmap <silent> <space>cgd <Plug>(coc-definition)
nmap <silent> <space>cgy <Plug>(coc-type-definition)
nmap <silent> <space>cgi <Plug>(coc-implementation)
nmap <silent> <space>cgr <Plug>(coc-references)
" Use K to show documentation in preview window
nnoremap <silent> <space>cK :call <SID>show_documentation()<CR>
" Use h to show documentation of symbol under cursor
nnoremap <silent> <space>ch :call CocActionAsync('doHover')<cr>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" Highlight symbol under cursor on CursorHold
autocmd CursorHold * silent call CocActionAsync('highlight')
" Remap for rename current word
nmap <space>crn <Plug>(coc-rename)
" Remap for format selected region
xmap <space>cf <Plug>(coc-format-selected)
nmap <space>cf <Plug>(coc-format-selected)
augroup mygroup
autocmd!
" Setup formatexpr specified filetype(s).
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
" Update signature help on jump placeholder
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end
" Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph
xmap <space>ca <Plug>(coc-codeaction-selected)
nmap <space>ca <Plug>(coc-codeaction-selected)
" Remap for do codeAction of current line
nmap <space>cac <Plug>(coc-codeaction)
" Fix autofix problem of current line
nmap <space>cqf <Plug>(coc-fix-current)
" Create mappings for function text object, requires document symbols feature of languageserver.
xmap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap if <Plug>(coc-funcobj-i)
omap af <Plug>(coc-funcobj-a)
" Use <C-x> for select selections ranges, needs server support, like: coc-tsserver, coc-python
nmap <silent> <C-x> <Plug>(coc-range-select)
xmap <silent> <C-x> <Plug>(coc-range-select)
" Use `:Format` to format current buffer
command! -nargs=0 Format :call CocAction('format')
" Use `:Fold` to fold current buffer
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" use `:OR` for organize import of current buffer
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
" Add status line support, for integration with other plugin, checkout `:h coc-status`
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
" Using CocList
" Show all diagnostics
nnoremap <silent> <space>ca :<C-u>CocList diagnostics<cr>
" Manage extensions
nnoremap <silent> <space>ce :<C-u>CocList extensions<cr>
" Show commands
nnoremap <silent> <space>cc :<C-u>CocList commands<cr>
" Find symbol of current document
nnoremap <silent> <space>co :<C-u>CocList outline<cr>
" Search workspace symbols
nnoremap <silent> <space>cs :<C-u>CocList -I symbols<cr>
" Do default action for next item.
nnoremap <silent> <space>cj :<C-u>CocNext<CR>
" Do default action for previous item.
nnoremap <silent> <space>ck :<C-u>CocPrev<CR>
" Resume latest coc list
nnoremap <silent> <space>cp :<C-u>CocListResume<CR>
" Multi-cursor
nmap <silent> <C-e> <Plug>(coc-cursors-word)
xmap <silent> <C-e> y/\V<C-r>=escape(@",'/\')<CR><CR>gN<Plug>(coc-cursors-range)gn
"-- "coc.nvim-plug" -: <leader>c
let g:coc_global_extensions = [
\ 'coc-vimlsp',
\ 'coc-tabnine',
\ 'coc-snippets',
\ 'coc-marketplace',
\ 'coc-html',
\ 'coc-highlight',
\ 'coc-explorer',
\ 'coc-calc',
\ 'coc-yaml',
\ 'coc-xml',
\ 'coc-tsserver',
\ 'coc-sh',
\ 'coc-r-lsp',
\ 'coc-python',
\ 'coc-phpls',
\ 'coc-json',
\ 'coc-java',
\ 'coc-dictionary',
\ 'coc-word',
\ 'coc-emoji',
\ 'coc-markdownlint',
\ 'coc-webview',
\ 'coc-reveal',
\ 'coc-browser',
\ 'coc-markdown-preview-enhanced',
\]
"--coc-snippet"
" Use <C-l> for trigger snippet expand.
imap <C-l> <Plug>(coc-snippets-expand)
" Use <C-j> for select text for visual placeholder of snippet.
vmap <C-j> <Plug>(coc-snippets-select)
" Use <C-j> for jump to next placeholder, it's default of coc.nvim
let g:coc_snippet_next = '<c-j>'
" Use <C-k> for jump to previous placeholder, it's default of coc.nvim
let g:coc_snippet_prev = '<c-k>'
" Use <C-j> for both expand and jump (make expand higher priority.)
imap <C-j> <Plug>(coc-snippets-expand-jump)
" Use <leader>x for convert visual selected code to snippet
xmap <leader>x <Plug>(coc-convert-snippet)
" Make <tab> used for trigger completion, completion confirm, snippet expand and jump like VSCode.
inoremap <silent><expr> <TAB>
\ pumvisible() ? coc#_select_confirm() :
\ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
let g:coc_snippet_next = '<tab>'
"--coc-calc"
" append result on current expression
nmap <Leader>ca <Plug>(coc-calc-result-append)
" replace result on current expression
nmap <Leader>cr <Plug>(coc-calc-result-replace))")"
"--coc-vimlsp"
"document highlight"
let g:markdown_fenced_languages = [
\ 'vim',
\ 'help'
\]
"-- "ludovicchabant/vim-gutentags"
" gutentags 搜索工程目录的标志,碰到这些文件/目录名就停止向上一级目录递归
let g:gutentags_project_root = ['.root', '.svn', '.git', '.hg', '.project']
" 所生成的数据文件的名称
let g:gutentags_ctags_tagfile = '.tags'
" 将自动生成的 tags 文件全部放入 ~/.cache/tags 目录中,避免污染工程目录
let s:vim_tags = expand('~/.cache/tags')
let g:gutentags_cache_dir = s:vim_tags
" 配置 ctags 的参数
let g:gutentags_ctags_extra_args = ['--fields=+niazS', '--extra=+q']
let g:gutentags_ctags_extra_args += ['--c++-kinds=+px']
let g:gutentags_ctags_extra_args += ['--c-kinds=+px']
" 检测 ~/.cache/tags 不存在就新建
if !isdirectory(s:vim_tags)
silent! call mkdir(s:vim_tags, 'p')
endif
"-- "prabirshrestha/asyncomplete.vim"
""inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
""inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
""inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<cr>"
""""imap <c-space> <Plug>(asyncomplete_force_refresh)
""""set completeopt+=preview "To enable preview window
""""autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif
"""vim-lsp:languages setting for asyncomplete.vim"
""if executable('pyls')
"" " pip install python-language-server
"" au User lsp_setup call lsp#register_server({
"" \ 'name': 'pyls',
"" \ 'cmd': {server_info->['pyls']},
"" \ 'whitelist': ['python'],
"" \ })
""endif
""if executable('ccls')
"" au User lsp_setup call lsp#register_server({
"" \ 'name': 'ccls',
"" \ 'cmd': {server_info->['ccls']},
"" \ 'root_uri': {server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'compile_commands.json'))},
"" \ 'initialization_options': {},
"" \ 'whitelist': ['c', 'cpp', 'objc', 'objcpp', 'cc'],
"" \ })
""endif
"""Register asyncomplete-file.vim"
""au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#file#get_source_options({
"" \ 'name': 'file',
"" \ 'whitelist': ['*'],
"" \ 'priority': 10,
"" \ 'completor': function('asyncomplete#sources#file#completor')
"" \ }))
"-- "sainnhe/vim-color-forest-night"
"set termguicolors
"colorscheme forest-night
"-- "lervag/vimtex"
let g:tex_flavor = 'latex'
"-- "puremourning/vimspector"
let g:vimspector_enable_mappings = 'HUMAN'
"-- "vim-airline/vim-airline" -: <leader>b
" Automatically displays all buffers when there's only one tab open.
let g:airline#extensions#tabline#enabled = 1
" buffer operations
" go to next buffer
map <Leader>bn :bnext<cr>
" go to previous buffer
map <Leader>bp :bprevious<cr>
" close current buffer
map <Leader>bd :bdelete<cr>
let g:airline_theme='deus'
"-- "jiangmiao/auto-pairs"
" When the filetype is FILETYPE then make AutoPairs only match for parenthesis
au Filetype FILETYPE let b:AutoPairs = {"(": ")"}
au FileType php let b:AutoPairs = AutoPairsDefine({'<?' : '?>', '<?php': '?>'})
"-- "liuchengxu/graphviz.vim"
" How to open the generated output file.
" If does not exist, graphviz.vim will automatically choose the right way depending on the platform.
let g:graphviz_viewer = 'fim'
" Default output format. Default is 'pdf'.
let g:graphviz_output_format = 'png'
" Options passed on to dot. Default is ''.
let g:graphviz_shell_option = ''"
"-- "kien/rainbow_parentheses.vim"
"au VimEnter * RainbowParenthesesToggle
"au Syntax * RainbowParenthesesLoadRound
"au Syntax * RainbowParenthesesLoadSquare
"au Syntax * RainbowParenthesesLoadBraces
"-- "Yggdroot/LeaderF"
" don't show the help in normal mode
let g:Lf_HideHelp = 1
let g:Lf_UseCache = 0
let g:Lf_UseVersionControlTool = 0
let g:Lf_IgnoreCurrentBufferName = 1
" popup mode
let g:Lf_WindowPosition = 'popup'
let g:Lf_PreviewInPopup = 1
let g:Lf_StlSeparator = { 'left': "\ue0b0", 'right': "\ue0b2", 'font': "DejaVu Sans Mono for Powerline" }
let g:Lf_PreviewResult = {'Function': 0, 'BufTag': 0 }
let g:Lf_ShortcutF = "<leader>ff"
let g:Lf_ShortcutB = "<leader>fb"
"noremap <leader>fb :<C-U><C-R>=printf("Leaderf buffer %s", "")<CR><CR>
noremap <leader>fm :<C-U><C-R>=printf("Leaderf mru %s", "")<CR><CR>
noremap <leader>ft :<C-U><C-R>=printf("Leaderf bufTag %s", "")<CR><CR>
noremap <leader>fl :<C-U><C-R>=printf("Leaderf line %s", "")<CR><CR>
noremap <C-B> :<C-U><C-R>=printf("Leaderf! rg --current-buffer -e %s ", expand("<cword>"))<CR>
noremap <C-F> :<C-U><C-R>=printf("Leaderf! rg -e %s ", expand("<cword>"))<CR>
" search visually selected text literally
xnoremap gf :<C-U><C-R>=printf("Leaderf! rg -F -e %s ", leaderf#Rg#visual())<CR>
noremap go :<C-U>Leaderf! rg --recall<CR>
" should use `Leaderf gtags --update` first
let g:Lf_GtagsAutoGenerate = 0
let g:Lf_Gtagslabel = 'native-pygments'
noremap <leader>fr :<C-U><C-R>=printf("Leaderf! gtags -r %s --auto-jump", expand("<cword>"))<CR><CR>
noremap <leader>fd :<C-U><C-R>=printf("Leaderf! gtags -d %s --auto-jump", expand("<cword>"))<CR><CR>
noremap <leader>fo :<C-U><C-R>=printf("Leaderf! gtags --recall %s", "")<CR><CR>
noremap <leader>fn :<C-U><C-R>=printf("Leaderf gtags --next %s", "")<CR><CR>
noremap <leader>fp :<C-U><C-R>=printf("Leaderf gtags --previous %s", "")<CR><CR>
"-- "luochen1990/rainbow"
let g:rainbow_active = 1
"" rainbow configuration
"let g:rainbow_conf = {
"\ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick'],
"\ 'ctermfgs': ['lightblue', 'lightyellow', 'lightcyan', 'lightmagenta'],
"\ 'guis': [''],
"\ 'cterms': [''],
"\ 'operators': '_,_',
"\ 'parentheses': ['start=/(/ end=/)/ fold', 'start=/\[/ end=/\]/ fold', 'start=/{/ end=/}/ fold'],
"\ 'separately': {
"\ '*': {},
"\ 'markdown': {
"\ 'parentheses_options': 'containedin=markdownCode contained',
"\ },
"\ 'lisp': {
"\ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick', 'darkorchid3'],
"\ },
"\ 'haskell': {
"\ 'parentheses': ['start=/(/ end=/)/ fold', 'start=/\[/ end=/\]/ fold', 'start=/\v\{\ze[^-]/ end=/}/ fold'],
"\ },
"\ 'vim': {
"\ 'parentheses_options': 'containedin=vimFuncBody',
"\ },
"\ 'perl': {
"\ 'syn_name_prefix': 'perlBlockFoldRainbow',
"\ },
"\ 'stylus': {
"\ 'parentheses': ['start=/{/ end=/}/ fold contains=@colorableGroup'],
"\ },
"\ 'css': 0,
"\ }
"\}
"" rainbownify csv
"let s:rainbow_conf = {
"\ 'separately': {
"\ 'csv': {
"\ 'parentheses': ['start=/\v[^,]+|(,\ze,)/ step=/\v\,/ end=/$/ keepend'],
"\ }
"\ }
"\ }
"-- "mechatroner/rainbow_csv"
"" detect csv dialects
"autocmd BufNewFile,BufRead *.csv set filetype=csv_semicolon
"autocmd BufNewFile,BufRead *.dat set filetype=csv_pipe
" disable default key mappings
let g:disable_rainbow_key_mappings = 1
"-- "skywind3000/quickmenu.vim"
"" choose a favorite key to show/hide quickmenu
"noremap <silent>qm :call quickmenu#toggle(0)<cr>
" enable cursorline (L) and cmdline help (H)
let g:quickmenu_options = "HL"
"-- "nathanaelkane/vim-indent-guides"
" have indent guides enabled by default
let g:indent_guides_enable_on_vim_startup = 1
"" Setting custom indent colors
"let g:indent_guides_auto_colors = 0
"autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=3
"autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=green ctermbg=4
"-- "dense-analysis/ale"
" In ~/.vim/vimrc, or somewhere similar.
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'javascript': ['eslint'],
\ 'c': ['clang-format'],
\}
"-- "FooSoft/vim-argwrap" -: <space>a
nnoremap <silent> <space>aw :ArgWrap<CR>
"-- "sheerun/vim-polyglot"
"-- "kshenoy/vim-signature"
let g:SignatureMap = {
\ 'Leader' : "m",
\ 'PlaceNextMark' : "m,",
\ 'ToggleMarkAtLine' : "m.",
\ 'PurgeMarksAtLine' : "m-",
\ 'DeleteMark' : "dm",
\ 'PurgeMarks' : "m<Space>",
\ 'PurgeMarkers' : "m<BS>",
\ 'GotoNextLineAlpha' : "']",
\ 'GotoPrevLineAlpha' : "'[",
\ 'GotoNextSpotAlpha' : "`]",
\ 'GotoPrevSpotAlpha' : "`[",
\ 'GotoNextLineByPos' : "]'",
\ 'GotoPrevLineByPos' : "['",
\ 'GotoNextSpotByPos' : "]`",
\ 'GotoPrevSpotByPos' : "[`",
\ 'GotoNextMarker' : "]-",
\ 'GotoPrevMarker' : "[-",
\ 'GotoNextMarkerAny' : "]=",
\ 'GotoPrevMarkerAny' : "[=",
\ 'ListBufferMarks' : "m/",
\ 'ListBufferMarkers' : "m?"
\ }
"-- "ntpeters/vim-better-whitespace"
let g:better_whitespace_operator='_s'
"-- "junegunn/vim-easy-align" -: <space>a
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap <space>ae <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap <space>ae <Plug>(EasyAlign)
"-- "embear/vim-localvimrc"
let g:localvimrc_file_directory_only=1
let g:localvimrc_sandbox=0
let g:localvimrc_ask=0
"let g:localvimrc_blacklist=
"-- "ZSaberLv0/ZFVimIM"
"function! s:myLocalDb()
"let db = ZFVimIM_dbInit({
" \ 'name' : 'YourDb',
" \ })
"call ZFVimIM_cloudRegister({
" \ 'mode' : 'local',
" \ 'dbId' : db['dbId'],
" \ 'repoPath' : '/path/to/repo',
" \ 'dbFile' : '/YourDbFile',
" \ 'dbCountFile' : '/YourDbCountFile',
" \ })
"endfunction
"autocmd User ZFVimIM_event_OnDbInit call s:myLocalDb()
"let g:zf_git_user_email=''
"let g:zf_git_user_name=''
"let g:zf_git_user_token=''
" fix the compatible problem with Vim-Which-Key
" autocmd VimEnter * unmap ;,
" autocmd VimEnter * unmap ;:
" autocmd VimEnter * unmap ;.
" autocmd VimEnter * unmap ;;
"-- "junegunn/vim-after-object"
autocmd VimEnter * call after_object#enable('=', ':', '-', '#', ' ')
"-- "tweekmonster/braceless.vim"
autocmd FileType python BracelessEnable +indent
"-- "liuchengxu/vim-which-key"
" By default timeoutlen is 1000 ms
set timeoutlen=500
let g:mapleader = "\<BSlash>"
" Register the description dictionary for the prefix <localleader> ,
"nnoremap <silent> <leader> :<c-u>WhichKey '<BSlash>'<CR>
nnoremap <silent> <localleader> :<c-u>WhichKey ';'<CR>
vnoremap <silent> <localleader> :<c-u>WhichKeyVisual ';'<CR>
" Register the description dictionary for the prefix <Space>
call which_key#register('<Space>', "g:which_key_space_map")
nnoremap <silent> <Space> :<c-u>WhichKey '<Space>'<CR>
vnoremap <silent> <Space> :<c-u>WhichKeyVisual '<Space>'<CR>
" add items to g:which_key_map:
" Define prefix dictionary
let g:which_key_space_map = {}
let g:which_key_space_map = {
\ 'a':{'name':'+Align'},
\ 'c':{'name':'+coc-nvim'},
\}
" Register the description dictionary for the prefix <BSlash>
call which_key#register('\', "g:which_key_leader_map")
nnoremap <silent> <leader> :<c-u>WhichKey '<BSlash>'<CR>
vnoremap <silent> <leader> :<c-u>WhichKeyVisual '<BSlash>'<CR>
" add items to g:which_key_map:
" Define prefix dictionary
let g:which_key_leader_map={}
let g:which_key_leader_map={
\ '\':{
\ 'name':'+vim-multi-visual',
\ 'g':{'name':'+VM-Reselect-Last'}
\ },
\ 'c':{'name':'+coc-calc-result'},
\ 'b':{'name':'+buffer'},
\ 'd':{'name':'+DrawIt'},
\ 'f':{'name':'+LeaderF'},
\ 'i':{'name':'+IndentGuidesToggle'},
\ 'm':{
\ 'name':'+incsearch-migemo',
\ 'g':{'name':'+incsearch-migemo-stay'}
\ },
\ 's':{
\ 'name':'+SaveWinPosn',
\ 'w':{'name':'+SaveWinPosn'}
\ },
\ 'r':{
\ 'name':'+RestoreWinPosn',
\ 'w':{'name':'+RestoreWinPosn'}
\ },
\}
" Register the description dictionary for the prefix ,
call which_key#register(',', "g:which_key_comma_map")
nnoremap <silent> , :<c-u>WhichKey ','<CR>
vnoremap <silent> , :<c-u>WhichKeyVisual ','<CR>
" add items to g:which_key_map:
" Define prefix dictionary
let g:which_key_comma_map = {}
"----------------------------------------------------------------------------"
"-- "User_function"
"-- "User_function_setting"
"----------------------------------------------------------------------------"
"-- "normal setting"
set nu
set rnu
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8
syntax enable
"" 检查单词拼写
"set spell!
"" 允许读取系统剪切板
"set clipboard=unnamed
set foldmethod=indent
"set foldmethod=syntax
"inoremap ' ''<LEFT>
"inoremap " ""<LEFT>
"inoremap ( ()<LEFT>
"inoremap [ []<LEFT>
"inoremap { {<CR>}<UP><ESC>A<TAB>
"jump out the ()[]""
" 使vim支持真彩色
"set termguicolors
" 使vim支持鼠标
"set mouse=a
" 打开/正则搜索即可匹配
set incsearch
" 打开/正则搜索高亮
set hlsearch
" ignorecase smartcase both on
set ignorecase
set smartcase
"" 打开行列高亮
"set cursorline
"set cursorcolumn
" show the matches just above the command line
set wildmenu
set autoindent
set cindent
set shiftwidth=4
set softtabstop=4
set tabstop=4
"ctags配置"
set tags=./.tags;,.tags
" Backup your vimrc configuration before you write it
" configuration from https://gist.github.com/nepsilon/003dd7cfefc20ce1e894db9c94749755
" Turn on backup option
set backup
" Where to store backups
set backupdir=~/.vim/backup/
" Make backup before overwriting the current buffer
set writebackup
" Overwrite the original backup file
set backupcopy=yes
" Meaningful backup name, ex: [email protected]:59
"au BufWritePre .vimrc let &bex = '@' . strftime("%F.%H:%M")
"Cursor_Settings"
"" set cursorcolumn "高亮当前列 cuc
"" set cursorline "高亮当前行 cul
" at least n line above/below the cursor.
set scrolloff=5
"GUI_Cursor_Settings_for_GVim"
""au InsertLeave * hi Cursor guibg=red "插入模式时是红色
""au InsertEnter * hi Cursor guibg=green "离开插入模式时是绿色