-
Notifications
You must be signed in to change notification settings - Fork 2
/
vimrc
1559 lines (1357 loc) · 48.1 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
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
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
" __ __ _ _ _
" | \/ |_ _ | \ | |_ _(_)_ __ ___
" | |\/| | | | | | \| \ \ / / | '_ ` _ \
" | | | | |_| | | |\ |\ V /| | | | | | |
" |_| |_|\__, | |_| \_| \_/ |_|_| |_| |_|
" |___/
" Author: @Zane Adams
" Checkout-list
" vim-esearch
" fmoralesc/worldslice
" SidOfc/mkdx
" ==================== Editor behavior ====================
"
set autochdir
set exrc
set secure
set encoding=UTF-8
set re=0
set number
set wrap
set noshowmode
set list
set listchars=tab:\|\ ,trail:▫
set relativenumber
set cursorline
set noexpandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set autoindent
set scrolloff=4
set ttimeoutlen=0
set notimeout
set viewoptions=cursor,folds,slash,unix
set wrap
set tw=0
set foldmethod=indent
set foldlevel=99
set foldenable
set formatoptions-=tc
"set splitright
set splitbelow
set noshowmode
set ignorecase
set smartcase
set inccommand=split
set lazyredraw
set visualbell
set shortmess+=c
"set guifont=Hack:h14
"set et sw=2
if has("ide")
set ideamarks
set ideajoin
endif
" =================== Basic Mappings ====================
"
" Quit and Write
imap jk <Esc>
map ; :
map wq :wq<CR>
map sa :q!<CR>
map qq :q<CR>
map R :source $MYVIMRC<CR>
map <leader>q :1,$d<CR>
map <M-d> :PlugInstall<CR>
noremap S :w<CR>
inoremap <C-s> <ESC> :w<CR>
" Window Next
noremap tp :bp<CR>
noremap tn :bn<CR>
" Space to Tab
nnoremap <LEADER>tt :%s/ /\t/g
vnoremap <LEADER>tt :s/ /\t/g
" Copy and Paste
inoremap <C-x> <ESC>yyddi
inoremap <M-x> <ESC>yypi
noremap tx :r !figlet
" ===================== Cursor Movement ================================
"
" Cursor movement (the default arrow keys are used for resizing windows)
" ^
" k
" < h l >
" j
" v
noremap <C-j> 5j
noremap <C-k> 5k
noremap <C-h> 5h
noremap <C-l> 5l
inoremap <C-h> <Left>
inoremap <C-j> <Down>
inoremap <C-k> <Up>
inoremap <C-l> <Right>
inoremap <C-d> <Delete>
inoremap 5k <Esc>
inoremap 5j <Esc>
inoremap <C-d> <ESC>xi
" Faster in-line navigation
noremap W 5w
noremap B 5b
" ==================== Command Mode Cursor Movement ====================
cnoremap <C-a> <Home>
cnoremap <C-e> <End>
cnoremap <C-k> <Up>
cnoremap <C-j> <Down>
cnoremap <C-h> <Left>
cnoremap <C-l> <Right>
cnoremap <M-b> <S-Left>
cnoremap <M-w> <S-Right>
" ==================== Window management ====================
" Use <space> + new arrow keys for moving the cursor around windows
noremap <LEADER>e <C-w>w
noremap <LEADER>w <C-w>k
noremap <LEADER>s <C-w>j
noremap <LEADER>a <C-w>h
noremap <LEADER>d <C-w>l
" split the screens to up (horizontal), down (horizontal), left (vertical), right (vertical)
noremap su :set nosplitbelow<CR>:split<CR>:set splitbelow<CR>
noremap se :set splitbelow<CR>:split<CR>
noremap sn :set nosplitright<CR>:vsplit<CR>:set splitright<CR>
noremap si :set splitright<CR>:vsplit<CR>
nmap ss :split<Return><C-w>w
nmap sv :vsplit<Return><C-w>w
" Resize splits with arrow keys
noremap <C-up> :res +5<CR>
noremap <C-down> :res -5<CR>
noremap <C-left> :vertical resize-5<CR>
noremap <C-right> :vertical resize+5<CR>
" ==================== Tab management ====================
"
" Create a new tab with tu
noremap tN :tabe<CR>
noremap <M-N> :tab split<CR>
" Move around tabs with tn and ti
noremap xl :-tabnext<CR>
noremap xr :+tabnext<CR>
" Move the tabs with tmn and tmi
noremap cl :-tabmove<CR>
noremap cr :+tabmove<CR>
" ==================== Markdown Settings ====================
"
" Snippets
" source $HOME/.config/nvim/md-snippets.vim
" auto spell
autocmd BufRead,BufNewFile *.md setlocal spell
" Compile function
noremap r :call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
if &filetype == 'c'
set splitbelow
:sp
:res -5
term gcc % -o %< && time ./%<
elseif &filetype == 'cpp'
set splitbelow
exec "!g++ -std=c++11 % -Wall -o %<"
:sp
:res -15
:term ./%<
elseif &filetype == 'cs'
set splitbelow
silent! exec "!mcs %"
:sp
:res -5
:term mono %<.exe
elseif &filetype == 'java'
set splitbelow
:sp
:res -5
term javac % && time java %<
elseif &filetype == 'sh'
:!time bash %
elseif &filetype == 'python'
set splitbelow
:sp
:term python3 %
elseif &filetype == 'html'
silent! exec "!".g:mkdp_browser." % &"
elseif &filetype == 'markdown'
exec "InstantMarkdownPreview"
elseif &filetype == 'tex'
silent! exec "VimtexStop"
silent! exec "VimtexCompile"
elseif &filetype == 'dart'
exec "CocCommand flutter.run -d ".g:flutter_default_device." ".g:flutter_run_args
silent! exec "CocCommand flutter.dev.openDevLog"
elseif &filetype == 'javascript'
set splitbelow
:sp
:term export DEBUG="INFO,ERROR,WARNING"; node --trace-warnings .
elseif &filetype == 'racket'
set splitbelow
:sp
:res -5
term racket %
elseif &filetype == 'go'
set splitbelow
:sp
:term go run .
endif
endfunc
" ==================== Plug Mappings ====================
"
" nerdtree
noremap <silent><C-e> :NERDTreeToggle<CR>
inoremap <silent><C-e> :NERDTreeToggle<CR>
" xtabline
noremap to :XTabCycleMode<CR>
noremap \p :echo expand('%:p')<CR>
" easymotion
map / <Plug>(easymotion-sn)
omap / <Plug>(easymotion-tn)
map <Leader>l <Plug>(easymotion-lineforward)
map <Leader>j <Plug>(easymotion-j)
map <Leader>k <Plug>(easymotion-k)
map <Leader>h <Plug>(easymotion-linebackward)
" tagbar & taglist
noremap <M-w> :Tlist<CR>
inoremap <M-w> <ESC>:Tlist<CR>
noremap <C-t> :TagbarToggle<CR>
inoremap <C-t> <ESC>:TagbarToggle<CR>
" clap
noremap <M-c> :Clap<CR>
" fzf
noremap <M-f> :FZF<CR>
" leaderf
noremap <M-q> :Leaderf
" rnvimr
noremap <C-r> :RnvimrToggle<CR>
" autoformat
noremap <F2> :Autoformat<CR>
" vista
noremap <M-v> :Vista<CR>
" Far
noremap <M-f> :Far<CR>
" ranger
noremap <M-r> :Ranger<CR>
" undotree
function g:Undotree_CustomMap()
nmap <buffer> u <plug>UndotreeNextState
nmap <buffer> e <plug>UndotreePreviousState
nmap <buffer> U 5<plug>UndotreeNextState
nmap <buffer> E 5<plug>UndotreePreviousState
endfunc
vmap ga :Tabularize /
" lightspeed
nmap <expr> f reg_recording() . reg_executing() == "" ? "<Plug>Lightspeed_f" : "f"
nmap <expr> F reg_recording() . reg_executing() == "" ? "<Plug>Lightspeed_F" : "F"
nmap <expr> t reg_recording() . reg_executing() == "" ? "<Plug>Lightspeed_t" : "t"
nmap <expr> T reg_recording() . reg_executing() == "" ? "<Plug>Lightspeed_T" : "T"
map <nowait> " <Plug>Lightspeed_omni_s
" surround
nmap xs ysiw
" coc.nvim
"inoremap <silent><expr> 1 <down><return>
"inoremap <silent><expr> 2 <down><down><return>
"inoremap <silent><expr> 3 <down><down><down><return>
"inoremap <silent><expr> 4 <down><down><down><down><return>
"inoremap <silent><expr> 5 <down><down><down><down><down><return>
"inoremap <silent><expr> <M-1> <up><return>
"inoremap <silent><expr> <M-2> <up><up><return>
"inoremap <silent><expr> <M-3> <up><up><up><return>
"inoremap <silent><expr> <M-4> <up><up><up><up><return>
"inoremap <silent><expr> <M-5> <up><up><up><up><up><return>
"inoremap <silent><expr> <Tab> <down><return>
" ==================== Install Plugins with Vim-Plug ====================
"
call plug#begin('$HOME/.config/nvim/plugged')
" Table of contents
Plug 'scrooloose/nerdtree'
Plug 'vim-scripts/taglist.vim'
Plug 'preservim/tagbar'
Plug 'kevinhwang91/rnvimr'
Plug 'mbbill/undotree'
Plug 'liuchengxu/vista.vim'
" Programming language
" HTML, CSS, JavaScript, PHP, JSON, etc.
Plug 'elzr/vim-json'
Plug 'hail2u/vim-css3-syntax'
Plug 'spf13/PIV', { 'for' :['php', 'vim-plug'] }
Plug 'gko/vim-coloresque', { 'for': ['vim-plug', 'php', 'html', 'javascript', 'css', 'less'] }
Plug 'pangloss/vim-javascript', { 'for' :['javascript', 'vim-plug'] }
Plug 'mattn/emmet-vim'
" java
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
Plug 'francoiscabrol/ranger.vim'
Plug 'rbgrouleff/bclose.vim'
" markdown
Plug 'suan/vim-instant-markdown', {'for': 'markdown'}
Plug 'dhruvasagar/vim-table-mode', { 'on': 'TableModeToggle', 'for': ['text', 'markdown', 'vim-plug'] }
Plug 'mzlogin/vim-markdown-toc', { 'for': ['gitignore', 'markdown', 'vim-plug'] }
Plug 'dkarter/bullets.vim'
Plug 'ferrine/md-img-paste.vim'
Plug 'godlygeek/tabular'
Plug 'plasticboy/vim-markdown'
" Optimization
Plug 'neovim/nvim-lspconfig'
" snippets
Plug 'honza/vim-snippets'
Plug 'kshenoy/vim-signature'
Plug 'prabirshrestha/vim-lsp'
" Search
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'ibhagwan/fzf-lua'
Plug 'pechorin/any-jump.vim'
Plug 'airblade/vim-rooter'
Plug 'liuchengxu/vim-clap', { 'do': { -> clap#installer#force_download() } }
Plug 'Yggdroot/LeaderF', { 'do': ':LeaderfInstallCExtension' }
Plug 'easymotion/vim-easymotion'
Plug 'haya14busa/incsearch.vim'
" Examination
Plug 'w0rp/ale'
Plug 'scrooloose/nerdcommenter'
"Plug 'puremourning/vimspector', {'do': './install_gadget.py --force-enable-java --force-enable-javac --enable-bash'}
Plug 'mhartington/formatter.nvim'
Plug 'brooth/far.vim'
Plug 'nvim-lua/plenary.nvim' " nvim-spectre dep
Plug 'nvim-pack/nvim-spectre'
Plug 'vim-autoformat/vim-autoformat'
" Editor Enhancement
Plug 'petertriho/nvim-scrollbar'
Plug 'kevinhwang91/nvim-hlslens'
Plug 'ggandor/lightspeed.nvim'
"Plug 'Raimondi/delimitMate'
Plug 'jiangmiao/auto-pairs'
Plug 'mg979/vim-visual-multi'
Plug 'tomtom/tcomment_vim' " in <space>cn to comment a line
Plug 'theniceboy/antovim' " gs to switch
Plug 'tpope/vim-surround' " type yskw' to wrap the word with '' or type cs'` to change 'word' to `word`
Plug 'gcmt/wildfire.vim' " in Visual mode, type k' to select all text in '', or type k) k] k} kp
Plug 'junegunn/vim-after-object' " da= to delete what's after =
Plug 'godlygeek/tabular' " ga, or :Tabularize <regex> to align
Plug 'tpope/vim-capslock' " Ctrl+L (insert) to toggle capslock
" Plug 'Konfekt/FastFold'
"Plug 'junegunn/vim-peekaboo'
"Plug 'wellle/context.vim'
Plug 'svermeulen/vim-subversive'
Plug 'theniceboy/argtextobj.vim'
Plug 'rhysd/clever-f.vim'
Plug 'AndrewRadev/splitjoin.vim'
Plug 'theniceboy/pair-maker.vim'
Plug 'theniceboy/vim-move'
" Plug 'jeffkreeftmeijer/vim-numbertoggle'
" Autocompletion
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'SirVer/ultisnips'
Plug 'wellle/tmux-complete.vim'
" ===Beautify===
" Status line
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
"Plug 'itchyny/lightline.vim'
"Plug 'theniceboy/eleline.vim', { 'branch': 'no-scrollbar' }
" Another
Plug 'itchyny/vim-gitbranch'
Plug 'tommcdo/vim-fugitive-blame-ext'
Plug 'mg979/vim-xtabline'
Plug 'luochen1990/rainbow'
" icons
Plug 'ryanoasis/vim-devicons'
Plug 'wincent/terminus'
Plug 'kristijanhusak/defx-icons'
Plug 'junegunn/vim-emoji'
"Plug 'adelarsq/vim-devicons-emoji'
Plug 'kyazdani42/nvim-web-devicons'
"Plug 'nathanaelkane/vim-indent-guides'
"Plug 'yggdroot/indentline'
Plug 'mhinz/vim-startify'
Plug 'morhetz/gruvbox'
Plug 'junegunn/vim-easy-align'
" ===Other===
Plug 'itchyny/calendar.vim'
"Plug 'anyakichi/vim-surround'
Plug 'junegunn/vim-github-dashboard'
" Treesitter
Plug 'nvim-treesitter/nvim-treesitter'
Plug 'nvim-treesitter/playground'
" Swift
Plug 'keith/swift.vim'
Plug 'arzg/vim-swift'
call plug#end()
" ==================== Configure ====================
"
" nerdtree
let NERDTreeShowBookmarks=1
let NERDTreeIgnore=['\.py[cd]$', '\~$', '\.swo$', '\.swp$', '^\.git$', '^\.hg$', '^\.svn$', '\.bzr$']
let NERDTreeChDirMode=0
let NERDTreeQuitOnOpen=1
let NERDTreeMouseMode=2
let NERDTreeShowHidden=1
let NERDTreeKeepTreeInNewTab=1
let g:nerdtree_tabs_open_on_gui_startup=0
function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg)
exec 'autocmd FileType nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg
exec 'autocmd FileType nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#'
endfunction
au VimEnter * call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515')
au VimEnter * call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#151515')
au VimEnter * call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515')
au VimEnter * call NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515')
au VimEnter * call NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#151515')
au VimEnter * call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515')
au VimEnter * call NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515')
au VimEnter * call NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#151515')
au VimEnter * call NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#151515')
au VimEnter * call NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515')
au VimEnter * call NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#151515')
au VimEnter * call NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515')
au VimEnter * call NERDTreeHighlightFile('rb', 'Red', 'none', '#ffa500', '#151515')
au VimEnter * call NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#151515')
autocmd VimEnter * call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515')
highlight! link NERDTreeFlags NERDTreeDir
" taglist
let Tlist_Ctags_Cmd = '/usr/bin/ctags'
let Tlist_Show_One_File = 1
let Tlist_Exit_OnlyWindow = 1
let Tlist_Use_Right_Window = 1
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1
" tagbar
filetype plugin indent on
let g:tagbar_ctags_bin='/usr/bin/ctags'
let g:tagbar_width=30
let g:tagbar_right=1
"highlight StorageClass cterm=bold ctermfg=darkgreen
"highlight Type cterm=bold ctermfg=blue
"highlight phpStructure cterm=bold ctermfg=darkred
"highlight phpFunctions cterm=bold ctermfg=256
"highlight Title ctermfg=blue
"highlight pythonString cterm=bold ctermfg=gray
"highlight pythonFunction cterm=bold
"highlight pythonInclude cterm=bold ctermfg=lightblue
"highlight javaScriptStringS ctermfg=gray
"highlight String ctermfg=gray
"hi Search cterm=NONE ctermfg=darkred ctermbg=yellow cterm=reverse
"highlight Directory ctermfg=blue
" rnvimr
let g:rnvimr_enable_ex = 1
let g:rnvimr_enable_picker = 1
let g:rnvimr_edit_cmd = 'drop'
let g:rnvimr_draw_border = 0
let g:rnvimr_hide_gitignore = 1
let g:rnvimr_border_attr = {'fg': 14, 'bg': -1}
let g:rnvimr_enable_bw = 1
let g:rnvimr_shadow_winblend = 70
let g:rnvimr_ranger_cmd = ['ranger', '--cmd=set draw_borders both']
highlight link RnvimrNormal CursorLine
let g:rnvimr_action = {
\ '<C-t>': 'NvimEdit tabedit',
\ '<C-x>': 'NvimEdit split',
\ '<C-v>': 'NvimEdit vsplit',
\ 'gw': 'JumpNvimCwd',
\ 'yw': 'EmitRangerCwd'
\ }
let g:rnvimr_ranger_views = [
\ {'minwidth': 90, 'ratio': []},
\ {'minwidth': 50, 'maxwidth': 89, 'ratio': [1,1]},
\ {'maxwidth': 49, 'ratio': [1]}
\ ]
let g:rnvimr_layout = {
\ 'relative': 'editor',
\ 'width': float2nr(round(0.7 * &columns)),
\ 'height': float2nr(round(0.7 * &lines)),
\ 'col': float2nr(round(0.15 * &columns)),
\ 'row': float2nr(round(0.15 * &lines)),
\ 'style': 'minimal'
\ }
let g:rnvimr_presets = [
\ {'width': 0.600, 'height': 0.600},
\ {},
\ {'width': 0.800, 'height': 0.800},
\ {'width': 0.950, 'height': 0.950},
\ {'width': 0.500, 'height': 0.500, 'col': 0, 'row': 0},
\ {'width': 0.500, 'height': 0.500, 'col': 0, 'row': 0.5},
\ {'width': 0.500, 'height': 0.500, 'col': 0.5, 'row': 0},
\ {'width': 0.500, 'height': 0.500, 'col': 0.5, 'row': 0.5},
\ {'width': 0.500, 'height': 1.000, 'col': 0, 'row': 0},
\ {'width': 0.500, 'height': 1.000, 'col': 0.5, 'row': 0},
\ {'width': 1.000, 'height': 0.500, 'col': 0, 'row': 0},
\ {'width': 1.000, 'height': 0.500, 'col': 0, 'row': 0.5}
\ ]
" undotree
if has("persistent_undo")
let target_path = expand('~/.undodir')
" create the directory and any parent directories
" if the location does not exist.
if !isdirectory(target_path)
call mkdir(target_path, "p", 0700)
endif
let &undodir=target_path
set undofile
endif
" vista
function! NearestMethodOrFunction() abort
return get(b:, 'vista_nearest_method_or_function', '')
endfunction
set statusline+=%{NearestMethodOrFunction()}
" By default vista.vim never run if you don't call it explicitly.
"
" If you want to show the nearest function in your statusline automatically,
" you can add the following line to your vimrc
autocmd VimEnter * call vista#RunForNearestMethodOrFunction()
" How each level is indented and what to prepend.
" This could make the display more compact or more spacious.
" e.g., more compact: ["▸ ", ""]
" Note: this option only works for the kind renderer, not the tree renderer.
let g:vista_icon_indent = ["╰─▸ ", "├─▸ "]
" Executive used when opening vista sidebar without specifying it.
" See all the avaliable executives via `:echo g:vista#executives`.
let g:vista_default_executive = 'ctags'
" Set the executive for some filetypes explicitly. Use the explicit executive
" instead of the default one for these filetypes when using `:Vista` without
" specifying the executive.
let g:vista_executive_for = {
\ 'cpp': 'coc',
\ 'php': 'coc',
\ }
" Declare the command including the executable and options used to generate ctags output
" for some certain filetypes.The file path will be appened to your custom command.
" For example:
let g:vista_ctags_cmd = {
\ 'haskell': 'hasktags -x -o - -c',
\ }
" To enable fzf's preview window set g:vista_fzf_preview.
" The elements of g:vista_fzf_preview will be passed as arguments to fzf#vim#with_preview()
" For example:
let g:vista_fzf_preview = ['right:50%']
" Ensure you have installed some decent font to show these pretty symbols, then you can enable icon for the kind.
let g:vista#renderer#enable_icon = 1
" The default icons can't be suitable for all the filetypes, you can extend it as you wish.
let g:vista#renderer#icons = {
\ "function": "\uf794",
\ "variable": "\uf71b",
\ }
" markdown
let g:instant_markdown_slow = 0
let g:instant_markdown_autostart = 0
" let g:instant_markdown_open_to_the_world = 1
" let g:instant_markdown_allow_unsafe_content = 1
" let g:instant_markdown_allow_external_content = 0
" let g:instant_markdown_mathjax = 1
let g:instant_markdown_autoscroll = 1
let g:mdip_imgdir = 'pic'
let g:mdip_imgname = 'image'
" vim-markdown-toc
"let g:vmt_auto_update_on_save = 0
"let g:vmt_dont_insert_fence = 1
let g:vmt_cycle_list_item_markers = 1
let g:vmt_fence_text = 'TOC'
let g:vmt_fence_closing_text = '/TOC'
vmap ga :Tabularize /
" clap
let g:clap_theme = 'material_design_dark'
let g:clap_layout = { 'relative': 'editor' }
" 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 }
" easymotion
let g:EasyMotion_smartcase = 1
let g:EasyMotion_use_smartsign_us = 1 " US layout
let g:EasyMotion_use_smartsign_jp = 1 " JP layout
let g:EasyMotion_use_migemo = 1
function! s:incsearch_config(...) abort
return incsearch#util#deepextend(deepcopy({
\ 'modules': [incsearch#config#easymotion#module({'overwin': 1})],
\ 'keymap': {
\ "\<CR>": '<Over>(easymotion)'
\ },
\ 'is_expr': 0
\ }), get(a:, 1, {}))
endfunction
" icon
function! Fzf_dev()
let l:fzf_files_options = ' -m --bind ctrl-d:preview-page-down,ctrl-u:preview-page-up --preview "bat --color always --style numbers {2..}"'
function! s:files()
let l:files = split(system($FZF_DEFAULT_COMMAND), '\n')
return s:prepend_icon(l:files)
endfunction
function! s:prepend_icon(candidates)
let result = []
for candidate in a:candidates
let filename = fnamemodify(candidate, ':p:t')
let icon = WebDevIconsGetFileTypeSymbol(filename, isdirectory(filename))
call add(result, printf("%s %s", icon, candidate))
endfor
return result
endfunction
function! s:edit_file(items)
let items = a:items
let i = 1
let ln = len(items)
while i < ln
let item = items[i]
let parts = split(item, ' ')
let file_path = get(parts, 1, '')
let items[i] = file_path
let i += 1
endwhile
call s:Sink(items)
endfunction
let opts = fzf#wrap({})
let opts.source = <sid>files()
let s:Sink = opts['sink*']
let opts['sink*'] = function('s:edit_file')
let opts.options .= l:fzf_files_options
call fzf#run(opts)
endfunction
" rainbow
let g:rainbow_active = 1 "0 if you want to enable it later via :RainbowToggle
" indentline
let g:indentLine_enabled = 1
let g:indentLinechar_list = ['|', '¦', '┆', '┊']
""let g:indentLinechar_list = ['·']
"let g:indent_guides_enable_on_vim_startup = 1
let g:indentLine_defaultGroup = 'SpecialKey'
let g:indentLine_concealcursor = 'inc'
let g:indentLine_conceallevel = 2
let g:indentLine_setConceal = 0
" ale
let g:ale_set_highlights = 0
let g:ale_sign_error = '✗'
let g:ale_sign_warning = '⚡'
let g:ale_statusline_format = ['✗ %d', '⚡ %d', '✔ OK']
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_warning_str = 'W'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
let g:ale_lint_on_enter = 1
let b:ale_linters = ['pylint']
let b:ale_fixers = ['autopep8', 'yapf']
let g:ale_linters = {
\ 'python': ['pyflakes'],
\}
"}}}
let g:ale_linters = {
\ 'c++': ['clang'],
\ 'c': ['clang'],
\ 'python': ['pyflakes'],
\}
" nerdcommend
let g:NERDToggleCheckAllLines = 1
" coc.nvim
let g:coc_global_extensions = [
\ 'coc-css',
\ 'coc-diagnostic',
\ 'coc-docker',
\ 'coc-eslint',
\ 'coc-explorer',
\ 'coc-markdownlint',
\ 'coc-highlight',
\ 'coc-tsserver',
\ 'coc-flutter-tools',
\ 'coc-gitignore',
\ 'coc-html',
\ 'coc-import-cost',
\ 'coc-java',
\ 'coc-jest',
\ 'coc-json',
\ 'coc-lists',
\ 'coc-translator',
\ 'coc-tasks',
\ 'coc-omnisharp',
\ 'coc-prettier',
\ 'coc-prisma',
\ 'coc-pyright',
\ 'coc-snippets',
\ 'coc-sourcekit',
\ 'coc-stylelint',
\ 'coc-syntax',
\ 'coc-tasks',
\ 'coc-translator',
\ 'coc-tsserver',
\ 'coc-vetur',
\ 'coc-vimlsp',
\ 'coc-yaml',
\ 'coc-yank']
" Set internal encoding of vim, not needed on neovim, since coc.nvim using some
let g:coc_explorer_global_presets = {
\ '.vim': {
\ 'root-uri': '~/.vim',
\ },
\ 'cocConfig': {
\ 'root-uri': '~/.config/coc',
\ },
\ 'tab': {
\ 'position': 'tab',
\ 'quit-on-open': v:true,
\ },
\ 'tab:$': {
\ 'position': 'tab:$',
\ 'quit-on-open': v:true,
\ },
\ 'floating': {
\ 'position': 'floating',
\ 'open-action-strategy': 'sourceWindow',
\ },
\ 'floatingTop': {
\ 'position': 'floating',
\ 'floating-position': 'center-top',
\ 'open-action-strategy': 'sourceWindow',
\ },
\ 'floatingLeftside': {
\ 'position': 'floating',
\ 'floating-position': 'left-center',
\ 'floating-width': 50,
\ 'open-action-strategy': 'sourceWindow',
\ },
\ 'floatingRightside': {
\ 'position': 'floating',
\ 'floating-position': 'right-center',
\ 'floating-width': 50,
\ 'open-action-strategy': 'sourceWindow',
\ },
\ 'simplify': {
\ 'file-child-template': '[selection | clip | 1] [indent][icon | 1] [filename omitCenter 1]'
\ },
\ 'buffer': {
\ 'sources': [{'name': 'buffer', 'expand': v:true}]
\ },
\ }
" unicode characters in the file autoload/float.vim
set encoding=utf-8
" TextEdit might fail if hidden is not set.
set hidden
" Some servers have issues with backup files, see #649.
set nobackup
set nowritebackup
" Give more space for displaying messages.
set cmdheight=2
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300
" Don't pass messages to |ins-completion-menu|.
set shortmess+=c
" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
if has("nvim-0.5.0") || has("patch-8.1.1564")
" Recently vim can merge signcolumn and number column into one
set signcolumn=number
else
set signcolumn=yes
endif
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<down><return>" :
\ CheckBackspace() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
"inoremap <expr><space> pumvisible() ? "\<C-n>"
noremap <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>'
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-@> coc#refresh()
endif
" Make <CR> auto-select the first completion item and notify coc.nvim to
" format on enter, <cr> could be remapped by other vim plugin
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
" Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window.
nnoremap <silent> K :call ShowDocumentation()<CR>
function! ShowDocumentation()
if CocAction('hasProvider', 'hover')
call CocActionAsync('doHover')
else
call feedkeys('K', 'in')
endif
endfunction
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)
" Formatting selected code.
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <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
" Applying codeAction to the selected region.
" Example: `<leader>aap` for current paragraph
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap keys for applying codeAction to the current buffer.
nmap <leader>ac <Plug>(coc-codeaction)
" Apply AutoFix to problem on the current line.
nmap <leader>qf <Plug>(coc-fix-current)
" Run the Code Lens action on the current line.
nmap <leader>cl <Plug>(coc-codelens-action)
" Map function and class text objects
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
xmap if <Plug>(coc-funcobj-i)
omap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap af <Plug>(coc-funcobj-a)
xmap ic <Plug>(coc-classobj-i)
omap ic <Plug>(coc-classobj-i)
xmap ac <Plug>(coc-classobj-a)
omap ac <Plug>(coc-classobj-a)
" Remap <C-f> and <C-b> for scroll float windows/popups.
if has('nvim-0.4.0') || has('patch-8.2.0750')
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
endif
" Use CTRL-S for selections ranges.
" Requires 'textDocument/selectionRange' support of language server.
nmap <silent> <C-s> <Plug>(coc-range-select)
xmap <silent> <C-s> <Plug>(coc-range-select)
" Add `:Format` command to format current buffer.
command! -nargs=0 Format :call CocActionAsync('format')
" Add `:Fold` command to fold current buffer.
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" Add `:OR` command for organize imports of the current buffer.