-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
1438 lines (1262 loc) · 48.3 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
set encoding=utf-8
scriptencoding utf-8
filetype off
function! DoRemote(arg)
UpdateRemotePlugins
endfunction
function! PlugIfExists(dir)
if isdirectory(a:dir)
Plug a:dir
endif
endfunction
call plug#begin()
" !sort -t/ -k2
Plug 'w0rp/ale', { 'tag': '*' } " syntax checking
Plug 'APZelos/blamer.nvim' " show per-line blame
Plug 'rhysd/conflict-marker.vim' " highlight git conflict markers
Plug 'vim-scripts/diffchar.vim' " show diffs on char basis
Plug 'rhysd/git-messenger.vim' " show git blame ,gm
Plug 'haya14busa/incsearch-fuzzy.vim' " z/
Plug 'haya14busa/incsearch.vim' " show all matches on incsearch
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' }
Plug 'scrooloose/nerdtree' " <S-F1>
Plug 'Xuyuanp/nerdtree-git-plugin' " show changed files
Plug 'chr4/nginx.vim'
Plug 'stefandtw/quickfix-reflector.vim' " edit then save in quickfix window
Plug 'saltstack/salt-vim' " salt highlighting
Plug 'andrewradev/sideways.vim' " operate on arglists ,sh ,sl aa ia
Plug 'rstacruz/sparkup' " HTML helper
Plug 'ervandew/supertab'
Plug 'majutsushi/tagbar' " <S-F2>
Plug 'wellle/targets.vim' " add * | and _ targets
Plug 'SirVer/ultisnips'
Plug 'mbbill/undotree' " ,gu
Plug 'chrisbra/unicode.vim' " ^G^F
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'FooSoft/vim-argwrap' " wrap multiline args ,a
Plug 'gioele/vim-autoswap' " deal with swapfiles sensibly
Plug 'alvan/vim-closetag' " close tags > >>
Plug 'tpope/vim-commentary' " gc
Plug 'christoomey/vim-conflicted' " :Conflicted :GitNextConflict, dgu, dgl
Plug 'ap/vim-css-color' " add colour to descriptions
Plug 'chrisbra/vim-diff-enhanced' " change diff algorithm
Plug 'tpope/vim-dispatch' " asynchronous build and test
Plug 'junegunn/vim-easy-align' " = ^X<regex>
Plug 'tpope/vim-eunuch' " Unix commands
Plug 'kopischke/vim-fetch' " use line numbers in file paths
Plug 'tpope/vim-fugitive' " :Gdiff :Gstatus ,gg, :Gblame, P, gq
Plug 'tommcdo/vim-fugitive-blame-ext' " extend :Gblame
Plug 'ruanyl/vim-gh-line' " ,gh ,gb
Plug 'airblade/vim-gitgutter' " <F3>,hn <F2>,hp ,hv <F1>,hs ,hr
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } " go
Plug 'ludovicchabant/vim-gutentags' " generate tags on the fly
Plug 'nathanaelkane/vim-indent-guides' " configured for indent of two or four
Plug 'michaeljsmith/vim-indent-object' " objects based on indentation ii AI
Plug 'lfv89/vim-interestingwords' " ,k ,K n N
Plug 'farmergreg/vim-lastplace' " save cursor position
Plug 'tommcdo/vim-lion' " alignment, gl gL glip=
Plug 'andymass/vim-matchup' " % [% ]% g% z%
Plug 'samoshkin/vim-mergetool' " git merging
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'sheerun/vim-polyglot' " extra syntax files
Plug 'tpope/vim-repeat'
Plug 'arzg/vim-rust-syntax-ext' " extra rust syntax highlighting
Plug 'zirrostig/vim-schlepp' " highlight then hjkl
Plug 'ojroques/vim-scrollstatus' " add scrollbar
Plug 'inside/vim-search-pulse' " * n N
Plug 'google/vim-searchindex' " show m/n for searches
Plug 'kshenoy/vim-signature' " mx dmx m, m. m<Space> m/
" Plug 'tpope/vim-sleuth' " indentation detection
Plug 'zsugabubus/crazy8.nvim' " indentation detection
Plug 'psliwka/vim-smoothie'
Plug 'justinmk/vim-sneak' " § ° f F t T
Plug 'honza/vim-snippets'
Plug 'mhinz/vim-startify' " startup screen
Plug 'tpope/vim-surround' " cs'" cs'<q> cst'
Plug 'baskerville/vim-sxhkdrc' "sxhkd syntax
Plug 'tmux-plugins/vim-tmux' " tmux syntax highlighting and more
Plug 'mattboehm/vim-unstack' " :UnstackFromSelection
Plug 'akracun/vitality.vim' " deal with focus for tmux
" Perl
Plug 'vim-perl/vim-perl', { 'for': 'perl', 'do':
\ 'make clean carp dancer highlight-all-pragmas moose test-more try-tiny heredoc-sql' }
Plug 'skaji/syntax-check-perl'
Plug 'vim-perl/vim-perl6'
" FZF
Plug 'sunaku/vim-shortcut' " , ,,
call PlugIfExists('/home/pjcj/g/ghq/github.com/junegunn/fzf')
call PlugIfExists('/usr/local/opt/fzf')
Plug 'junegunn/fzf.vim'
" CtrlP
Plug 'ctrlpvim/ctrlp.vim' " <F11>
Plug 'sgur/ctrlp-extensions.vim' " cmdline, yank and menu for ctrlp
Plug 'suy/vim-ctrlp-unicode'
Plug 'zeero/vim-ctrlp-help'
" Denite and unite, plugins for denite
let g:neomru#file_mru_limit = 8
Plug 'Shougo/neco-syntax' " needed for denite
Plug 'Shougo/denite.nvim'
Plug 'chemzqm/denite-extra'
Plug 'Shougo/unite.vim'
Plug 'Shougo/neomru.vim'
Plug 'yuku-t/unite-git'
Plug 'Shougo/unite-outline'
Plug 'soh335/unite-perl-module'
Plug 'pjcj/neovim-colors-solarized-truecolor-only'
" Plug 'neovim/nvim-lspconfig'
" CoC
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'wellle/tmux-complete.vim'
Plug 'ryanoasis/vim-devicons' " add icons after other plugins
" suppress the annoying 'match x of y', 'The only match' and 'Pattern not
" found' messages
set shortmess+=c
if has('nvim')
Plug 'bfredl/nvim-miniyank' " yankring <C-Y> g-
else
if system('perl -e "print eval q(use Code::ART::API::Vim; 1)"') =~? '1'
let s:perlart = expand($HOME . '/.vim/local/perlart.vim')
if filereadable(s:perlart)
exec 'source ' . s:perlart
echo 'perlart: ' s:perlart
endif
endif
endif
call plug#end()
" lua << EOF
" require'lspconfig'.gopls.setup{}
" EOF
let g:mapleader = ','
runtime plugin/shortcut.vim
Shortcut show shortcut menu and run chosen shortcut
\ noremap <silent> <Leader><Leader> :Shortcuts<Return>
Shortcut fallback to shortcut menu on partial entry
\ noremap <silent> <Leader> :Shortcuts<Return>
filetype plugin indent on
set autoindent
set autowriteall
set backspace=indent,eol,start
set backup
set backupcopy=yes,breakhardlink
set backupdir=~/g/tmp/vim/
set backupext=.bak
set clipboard= " don't send yanks, deletes and changes to any clipboard
set cmdheight=3
set colorcolumn=80,120
set commentstring=#\ %s
set complete=.,w,b,u,U,k/usr/share/dict/words,i,t
set dictionary=/usr/share/dict/words
set diffopt=internal,filler,vertical
set directory=>~/g/tmp/vim/
set errorformat=%f:%l:%m
set expandtab
set exrc
set fillchars=fold:\ " leave trainling space
set formatoptions=tcrqnlj
set guifont=inconsolata\ \for\ powerline\ 12
set hidden " needed for completor
set history=1000
set hlsearch
set icon
set ignorecase
set incsearch
set joinspaces
set laststatus=2
set lazyredraw
set list
set listchars=tab:»\ ,trail:·
set matchpairs+=<:>
set modelines=1
set mouse=a
set mousefocus
set mousehide
set mousemodel=popup_setpos
set nosmartindent
set nosmarttab
set number
set path=,,.,/usr/include
set report=1
set ruler
set scrolloff=5
set shell=zsh
set shiftround
set shiftwidth=4
set showcmd
set showmatch
set showmode
set smartcase
set softtabstop=0
set suffixes=.d,.e,.o,.org,.bak,~
set tabstop=8
set tagrelative
set tags=./tags,tags,../tags,../../tags,../../../tags,../../../../tags
set textwidth=0
set title
set ttimeoutlen=50
set ttyfast
set undodir=~/g/tmp/vim
set undofile
set undolevels=10000
set updatetime=250
set viminfo='50
set whichwrap=19
set wildmenu
set wildmode=list:longest,full
set writebackup
if executable('rg')
set grepprg=rg\ --no-heading\ --hidden\ --glob\ '!.git'\ --vimgrep
set grepformat=%f:%l:%c:%m
else
set grepprg=git\ grep\ -n
endif
if has('nvim')
set inccommand=split
endif
if has('nvim-0.4')
set wildmode=longest,full,full
set wildoptions=pum,tagfile
endif
syntax enable
set background=dark
set termguicolors
" let g:solarized_contrast='high'
" let g:solarized_visibility='normal'
colorscheme solarized
let s:base03 = '#001920'
let s:base02 = '#022731'
let s:base01 = '#586e75'
let s:base00 = '#657b83'
let s:base0 = '#839496'
let s:base1 = '#93a1a1'
let s:base2 = '#eee8d5'
let s:base3 = '#fdf6e3'
let s:yellow = '#b58900'
let s:orange = '#cb4b16'
let s:red = '#dc322f'
let s:magenta = '#d33682'
let s:violet = '#6c71c4'
let s:blue = '#268bd2'
let s:cyan = '#2aa198'
let s:green = '#859900'
let s:normal = '#9599dc'
let s:rgreen = '#25ad2e' " a nice green for diffs (opposite of s:red)
let s:base04 = '#00090C' " darker than base03
let s:base05 = '#0E3C49' " lighter than base02
function! Set_colour(group, part, colour)
execute 'highlight ' . a:group . ' ' . a:part . '=' . a:colour
endfunction
call Set_colour('Normal', 'guifg', s:normal)
call Set_colour('SpecialKey', 'guibg', s:base03)
call Set_colour('SpellBad', 'guibg', s:violet)
call Set_colour('SpellBad', 'guifg', s:base03)
call Set_colour('SpellBad', 'gui', 'NONE' )
call Set_colour('SpellCap', 'guibg', s:blue )
call Set_colour('SpellCap', 'guifg', s:base03)
call Set_colour('SpellCap', 'gui', 'NONE' )
call Set_colour('SpellRare', 'guibg', s:yellow)
call Set_colour('SpellRare', 'guifg', s:base03)
call Set_colour('SpellRare', 'gui', 'NONE' )
call Set_colour('SpellLocal', 'guibg', s:green )
call Set_colour('SpellLocal', 'guifg', s:base03)
call Set_colour('SpellLocal', 'gui', 'NONE' )
call Set_colour('LineNr', 'guibg', s:base03)
call Set_colour('CursorLine', 'guibg', s:base02)
call Set_colour('CursorColumn', 'guibg', s:base02)
call Set_colour('CursorLineNr', 'guibg', s:base03)
call Set_colour('DiffAdd', 'guibg', s:base03)
call Set_colour('DiffAdd', 'guifg', s:rgreen)
call Set_colour('DiffChange', 'guibg', s:base03)
call Set_colour('DiffDelete', 'guibg', s:base03)
call Set_colour('diffAdded', 'guifg', s:rgreen)
call Set_colour('Search', 'guibg', s:violet)
call Set_colour('Search', 'guifg', s:base03)
call Set_colour('Search', 'gui', 'NONE' )
call Set_colour('TabLineSel', 'guibg', s:base03)
call Set_colour('TabLineSel', 'guifg', s:violet)
call Set_colour('Folded', 'gui', 'NONE' )
call Set_colour('MatchParen', 'guibg', s:base00)
call Set_colour('MatchParen', 'guifg', 'NONE' )
call Set_colour('MatchParenCur','guibg', s:base02)
call Set_colour('MatchParenCur','guifg', 'NONE' )
call Set_colour('NormalFloat', 'guibg', s:base04)
Shortcut! <C-S-P> show syntax class of item under cursor
nmap <C-S-P> :call <SID>SynStack()<CR>
function! <SID>SynStack()
if !exists('*synstack')
return
endif
echo map(synstack(line('.'), col('.')), "synIDattr(v:val, 'name')")
endfunction
set guicursor=n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20
set guicursor+=a:blinkwait700-blinkon400-blinkoff250
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_indent_levels = 40
function! Setup_indent_guides()
let g:indent_guides_auto_colors = 0
call Set_colour('IndentGuidesEven', 'guibg', s:base02)
setlocal listchars=tab:»\ ,trail:·
setlocal tabstop=8
if &filetype ==# 'go' || &filetype ==# 'make'
setlocal listchars=tab:\ \ ,trail:·
setlocal tabstop=2
call Set_colour('IndentGuidesOdd', 'guibg', s:base03)
elseif &shiftwidth < 3
let g:indent_guides_guide_size = 0
call Set_colour('IndentGuidesOdd', 'guibg', 'NONE')
" echo 'small: ' &shiftwidth
else
let g:indent_guides_guide_size = 1
let g:indent_guides_start_level = 2
call Set_colour('IndentGuidesOdd', 'guibg', s:base02)
" echo 'big: ' &shiftwidth
endif
endfunction
let g:airline_theme = 'solarized'
let g:airline_powerline_fonts = 1
let g:scrollstatus_size = 24
let g:airline_solarized_normal_green = 1
let g:airline_section_x = '%{ScrollStatus()}'
let g:airline_section_z = airline#section#create([
\ '%#__accent_bold#%3l%#__restore__#/%L', ' ',
\ '%#__accent_bold#%3v%#__restore__#/%3{virtcol("$") - 1}',
\ ])
augroup file_types
autocmd!
autocmd BufNewFile,BufReadPost template/* set ft=tt2html
autocmd BufNewFile,BufReadPost *.tt2 set ft=tt2html
autocmd BufNewFile,BufReadPost *.tt set ft=tt2html
autocmd BufNewFile,BufReadPost *.t set ft=perl
autocmd BufNewFile,BufReadPost *.pd set ft=perl
autocmd BufNewFile,BufReadPost *.pm set ft=perl " not raku
autocmd BufNewFile,BufReadPost *.mc set ft=mason
autocmd BufRead *tmp/ml/mutt-*
\ setlocal colorcolumn=72 tw=72 spell spelllang=en_gb
autocmd Filetype gitcommit
\ setlocal colorcolumn=50,72 tw=72 spell spelllang=en_gb
" fake event so that completions area available to deoplete
autocmd BufReadPost * if exists("g:deoplete#_context")
\ | call deoplete#send_event('BufWritePost')
\ | endif
" use dictionary in deoplete
autocmd BufReadPost * setlocal dictionary+=/usr/share/dict/words
autocmd InsertLeave * if expand("%") != "" | update | endif
autocmd FileType xhtml,xml,html,tt2html,mason setlocal sw=2
" close quickfix, location and preview list windows
autocmd FileType qf if mapcheck('<Esc>', 'n') ==# ''
\ | nnoremap <buffer><silent> <Esc> :cclose<Bar>lclose<Bar>:pclose<CR>
\ | endif
augroup end
let g:startify_change_to_vcs_root = 1
let g:startify_fortune_use_unicode = 1
let g:startify_lists = [
\ { 'type': 'dir', 'header': [' MRU '. getcwd()] },
\ { 'type': 'files', 'header': [' MRU'] },
\ { 'type': 'sessions', 'header': [' Sessions'] },
\ { 'type': 'bookmarks', 'header': [' Bookmarks'] },
\ { 'type': 'commands', 'header': [' Commands'] },
\ ]
" Coc
let g:coc_global_extensions = [
\ 'coc-json',
\ 'coc-tsserver',
\ 'coc-html',
\ 'coc-css',
\ 'coc-rls',
\ 'coc-yaml',
\ 'coc-snippets',
\ 'coc-lists',
\ 'coc-yank',
\ 'coc-vimlsp',
\ 'coc-tailwindcss'
\ ]
" \ 'coc-git', # this gets very slow
" \ 'coc-highlight',
augroup coc
Shortcut goto definition
\ nmap <silent> gd <Plug>(coc-definition)
Shortcut goto type definition
\ nmap <silent> gy <Plug>(coc-type-definition)
Shortcut goto implementation
\ nmap <silent> gi <Plug>(coc-implementation)
Shortcut goto references
\ nmap <silent> gr <Plug>(coc-references)
" Highlight symbol under cursor on CursorHold
" autocmd CursorHold * silent call CocActionAsync('highlight')
Shortcut rename current word
\ nmap <leader>rn <Plug>(coc-rename)
augroup end
" Perl options
let perl_fold = 1
let perl_nofold_packages = 1
let perl_nofold_subs = 1
let perl_sub_signatures = 1
Shortcut toggle all folds
\ nnoremap <expr> zz &foldlevel ? 'zM' :'zR'
" Go options
let g:go_highlight_array_whitespace_error = 1
let g:go_highlight_build_constraints = 1
let g:go_highlight_chan_whitespace_error = 1
let g:go_highlight_diagnostic_errors = 1
let g:go_highlight_diagnostic_warnings = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_format_strings = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_function_parameters = 1
let g:go_highlight_functions = 1
let g:go_highlight_generate_tags = 1
let g:go_highlight_operators = 1
let g:go_highlight_space_tab_error = 1
let g:go_highlight_string_spellcheck = 1
let g:go_highlight_types = 1
let g:go_highlight_variable_assignments = 1
let g:go_highlight_variable_declarations = 1
let g:go_auto_sameids = 1
let g:go_auto_type_info = 1
let g:go_diagnostics_level = 2
let g:go_doc_popup_window = 1
let g:go_fmt_experimental = 1
let g:go_list_type = 'quickfix'
let g:go_metalinter_autosave = 1
let g:go_metalinter_autosave_enabled = ['all']
let g:go_metalinter_enabled = ['all']
let g:go_gopls_gofumpt = 1
let g:go_imports_mode = 'gopls'
let g:go_fmt_options = {
\ 'gofmt': '-s',
\ }
" Java options
set cinoptions+=j1 " anonymous classes
let g:java_comment_strings = 1
let g:java_highlight_java_lang_ids = 1
let g:java_highlight_all = 1
let g:java_highlight_debug = 1
let g:java_ignore_javadoc = 1
let g:java_highlight_java_lang_ids = 1
let g:java_highlight_functions = 'style'
" let g:html_indent_script1 = 'inc'
" let g:html_indent_style1 = 'inc'
" let g:html_indent_inctags = 'html,body,head,tbody,p,li,dd,dt,h1,h2,h3,h4,h5,h6,blockquote,section'
let g:UltiSnipsJumpForwardTrigger = '<tab>'
let g:UltiSnipsJumpBackwardTrigger = '<s-tab>'
let g:gutentags_ctags_exclude = ['blib', 'tmp']
" can be extended with '*/sub/path' if required
let g:gutentags_generate_on_new = 1
let g:gutentags_generate_on_missing = 1
let g:gutentags_generate_on_write = 1
let g:gutentags_generate_on_empty_buffer = 0
let g:git_messenger_always_into_popup = 1
let g:git_messenger_include_diff = 'current'
let g:blamer_enabled = 1
let g:blamer_show_in_visual_modes = 0
let g:blamer_show_in_insert_modes = 1
let g:blamer_prefix = ' '
let g:blamer_template = '<author>, <author-time> • <summary>'
let g:blamer_date_format = '%Y-%m-%d %H:%M'
call Set_colour('Blamer','guifg', s:base05)
let g:NERDTreeShowHidden = 1
let g:NERDTreeHighlightCursorline = 0
" taglist plugin
let g:Tlist_Use_SingleClick = 1
let g:Tlist_Use_Right_Window = 1
let g:Tlist_Auto_Open = 0
let g:Tlist_Show_One_File = 0
let g:Tlist_WinWidth = 32
let g:Tlist_Compact_Format = 1
let g:Tlist_Exit_OnlyWindow = 1
let g:Tlist_File_Fold_Auto_Close = 1
let g:Tlist_Process_File_Always = 1
let g:Tlist_Enable_Fold_Column = 0
let g:Tlist_Show_Menu = 1
let g:tagbar_width = 32
let g:tagbar_autoclose = 1
let g:tagbar_autofocus = 1
let g:tagbar_sort = 1
let g:tagbar_compact = 1
let g:tagbar_indent = 1
let g:tagbar_show_visibility = 1
let g:tagbar_show_linenumbers = 0
let g:tagbar_singleclick = 1
let g:tagbar_autoshowtag = 1
augroup git
autocmd!
autocmd BufReadPost fugitive://* set bufhidden=delete
autocmd QuickFixCmdPost *grep* cwindow
augroup end
Shortcut show git diff
\ nnoremap <leader>gd :Git diff<CR>
Shortcut make git commit
\ nnoremap <leader>gg :Git commit -v<CR>
Shortcut show git status
\ nnoremap <leader>gs :Git status<CR>
augroup gitgutter
autocmd!
autocmd BufEnter * call GitGutter()
augroup end
highlight! link SignColumn LineNr
highlight link GitGutterAdd DiffAdd
highlight link GitGutterChange DiffChange
highlight link GitGutterDelete DiffDelete
highlight link GitGutterChangeDelete DiffDelete
highlight link GitGutterAddLine DiffAdd
highlight link GitGutterChangeLine DiffChange
highlight link GitGutterDeleteLine DiffDelete
highlight link GitGutterChangeDeleteLine DiffDelete
let g:gitgutter_signs = 1
let g:gitgutter_highlight_lines = 0
let g:gitgutter_realtime = 1
let g:gitgutter_eager = 1
let g:gitgutter_map_keys = 0
Shortcut jump to next hunk
\ nnoremap <leader>hn :GitGutterNextHunk<CR>
Shortcut jump to previous hunk
\ nnoremap <leader>hp :GitGutterPrevHunk<CR>
Shortcut preview current hunk
\ nnoremap <leader>hv :GitGutterPreviewHunk<CR>
Shortcut stage current hunk
\ nnoremap <leader>hs :GitGutterStageHunk<CR>
Shortcut undo current hunk
\ nnoremap <leader>hr :GitGutterUndoHunk<CR>
let g:conflict_marker_begin = '^<<<<<<< .*$'
let g:conflict_marker_end = '^>>>>>>> .*$'
" let g:conflict_marker_separator = '^\(=======|\|\|\|\|\|\|\| .*\)$'
" let g:conflict_marker_separator = '^\(=======|XXXXXX\)$'
let g:SignatureMarkTextHLDynamic = 1
let g:vitality_tumx_can_focus = 1
let g:csv_autocmd_arrange = 1
let g:mkdp_auto_start = 0
let g:mkdp_auto_close = 1
Shortcut toggle markdown preview
\ nmap <silent> <C-p> <Plug>MarkdownPreviewToggle
" diffchar sets defaults if these aren't set
nmap <silent> abc1 <Plug>ToggleDiffCharAllLines
nmap <silent> abc2 <Plug>ToggleDiffCharCurrentLine
nmap <silent> abc3 <Plug>JumpDiffCharPrevStart
nmap <silent> abc4 <Plug>JumpDiffCharNextStart
nmap <silent> abc5 <Plug>JumpDiffCharPrevEnd
nmap <silent> abc6 <Plug>JumpDiffCharNextEnd
" get vim-search-pulse and vim-interestingwords working together
" stop plugin overwriting mappings
function! Pulse_col(colour)
call Set_colour('CursorLine', 'guibg', a:colour)
call Set_colour('CursorColumn', 'guibg', a:colour)
endfunction
function! Pulse_on()
let s:ccl = &cursorline
set cursorline
set cursorcolumn
call Pulse_col(s:yellow)
endfunction
function! Pulse_off()
let &cursorline = s:ccl
let &cursorcolumn = s:ccl
call Pulse_col(s:base02)
endfunction
function! Pulse()
exe 'normal zz'
call search_pulse#Pulse()
endfunction
augroup Pulse
autocmd!
autocmd User PrePulse call Pulse_on()
autocmd User PostPulse call Pulse_off()
" Pulses the first match after hitting the enter key
autocmd! User IncSearchExecute
autocmd User IncSearchExecute :call search_pulse#Pulse()
augroup end
map <leader>interestingwords <Plug>InterestingWords
let g:vim_search_pulse_disable_auto_mappings = 1
let g:vim_search_pulse_mode = 'pattern' " or cursor_line
let g:vim_search_pulse_duration = 100
let g:interestingWordsGUIColors =
\ ['#72b5e4', '#f0c53f', '#ff8784', '#c5c7f1',
\ '#c2d735', '#78d3cc', '#ea8336', '#e43542',
\ '#ebab35', '#ebe735', '#aadd32', '#dcca6b',
\ '#219286', '#2f569c', '#ffb577', '#5282a4',
\ '#edfccf', '#67064c', '#f5bca7', '#95c474',
\ '#dece83', '#de9783', '#f2e700', '#e9e9e9',
\ '#69636d', '#626b98', '#f5f5a7', '#dcca6b',
\ '#b72a83', '#6f2b9d', '#69636d', '#5f569c']
augroup SearchIndex
autocmd!
autocmd VimEnter * call <SID>OverridePluginSettings()
function! s:OverridePluginSettings()
nmap <silent> * *``:call InterestingWords('n')<CR>
\ :set nohls<CR>
\ :call Pulse()<CR>
\ <Plug>SearchIndex
nmap <silent> n :call WordNavigation(1)<CR>
\ :call Pulse()<CR><Plug>SearchIndex
nmap <silent> N :call WordNavigation(0)<CR>
\ :call Pulse()<CR><Plug>SearchIndex
endfunction
augroup end
Shortcut (nv) toggle highlighting of interesting words
\ nnoremap <silent> <leader>k :call InterestingWords('n')<CR>
\|vnoremap <silent> <leader>k :call InterestingWords('v')<CR>
Shortcut turn off highlighting of interesting words
\ nnoremap <silent> <leader>K :call UncolorAllWords()<CR>
function! s:config_fuzzyall(...) abort
set hlsearch
return extend(copy({
\ 'converters': [
\ incsearch#config#fuzzy#converter(),
\ incsearch#config#fuzzyspell#converter()
\ ],
\ }), get(a:, 1, {}))
endfunction
Shortcut! z/ incremental fuzzy search forward
noremap <silent><expr> z/ incsearch#go(<SID>config_fuzzyall())
Shortcut! z? incremental fuzzy search backward
noremap <silent><expr> z? incsearch#go(<SID>config_fuzzyall({'command': '?'}))
Shortcut! zg/ incremental fuzzy search backward without moving
noremap <silent><expr> zg/ incsearch#go(<SID>config_fuzzyall({'is_stay': 1}))
map / :set hls<CR><Plug>(incsearch-forward)
Shortcut toggle search highlighting
\ nnoremap <silent> <leader><space> :let @/ = ""<BAR> :set hls!<BAR>
\ :call UncolorAllWords()<BAR>
\ :echo "HLSearch: " . strpart("OffOn",3*&hlsearch,3)<CR>
Shortcut (v) schlepp up
\ vmap <unique> k <Plug>SchleppUp
Shortcut (v) schlepp down
\ vmap <unique> j <Plug>SchleppDown
Shortcut (v) schlepp left
\ vmap <unique> h <Plug>SchleppLeft
Shortcut (v) schlepp right
\ vmap <unique> l <Plug>SchleppRight
Shortcut move up one logical line
\ nnoremap k gk
Shortcut move down one logical line
\ nnoremap j gj
Shortcut toggle argument and parameter wrapping
\ nnoremap <silent> <leader>a :ArgWrap<CR>
let g:argwrap_padded_braces = '[{'
let g:argwrap_tail_comma = 1
Shortcut (nv) generate digraph from characters
\ nmap <leader>dg <Plug>(MakeDigraph)
\|vmap <leader>dg <Plug>(MakeDigraph)
Shortcut describe character under cursor
\ nmap ga <Plug>(UnicodeGA)
Shortcut! :UnicodeTable<CR> show table of all unicode characters
Shortcut! :Digraphs<CR> show digraph table
Shortcut! :Digraphs!<CR> show extended digraph table
Shortcut! :Digraphs! show digraph table matching argument
Shortcut! <C-X><C-G> complete as digraph
Shortcut! <C-X><C-Z> complete as unicode
Shortcut! <C-G><C-F> unicode fuzzy finder with fzf
augroup autowrite
autocmd!
autocmd FocusLost * silent! wa
augroup end
set guioptions=ag
function! s:get_visual_selection()
let [l:lnum1, l:col1] = getpos("'<")[1:2]
let [l:lnum2, l:col2] = getpos("'>")[1:2]
let l:lines = getline(l:lnum1, l:lnum2)
let l:lines[-1] = l:lines[-1]
\[: l:col2 - (&selection ==# 'inclusive' ? 1 : 2)]
let l:lines[0] = l:lines[0][l:col1 - 1:]
return join(l:lines, ' ')
endfunction
function! Grep_visual(text)
execute "silent grep! '" . a:text . "'"
endfunction
command! GrepVisual call Grep_visual(s:get_visual_selection())
Shortcut stage current hunk
\ nnoremap <F1> :GitGutterStageHunk<CR>
Shortcut jump to previous hunk
\ nnoremap <F2> :GitGutterPrevHunk<CR>
Shortcut jump to next hunk
\ nnoremap <F3> :GitGutterNextHunk<CR>
Shortcut undo hunk
\ nnoremap <C-F1> :GitGutterUndoHunk<CR>
Shortcut preview hunk
\ nnoremap <C-F2> :GitGutterPreviewHunk<CR>
Shortcut toggle NERDTree filesystem viewer
\ nnoremap <S-F1> :NERDTreeToggle<CR>
Shortcut toggle tagbar subroutine funtion method viewer
\ nnoremap <S-F2> :TagbarToggle<CR>
Shortcut jump to tag
\ nnoremap <F4> :execute "tjump /^\\(_build_\\)\\?" .
\ expand("<cword>") . "$"
\ <Bar> :call Pulse()<CR>
Shortcut jump to next tag
\ nnoremap <S-F4> :tnext<Bar>:call Pulse()<CR>
Shortcut jump to previous tag
\ nnoremap <M-F4> :tprev<Bar>:call Pulse()<CR>
if filereadable('Makefile')
Shortcut run make
\ nnoremap <F5> :execute "silent make" <Bar> botright copen<CR><C-L>
else
Shortcut run make
\ nnoremap <F5> :w<CR>
endif
Shortcut display current error from quickfix list
\ nnoremap <S-F5> :cc<CR>
Shortcut display current error from location list
\ nnoremap <C-F5> :ll<CR>
Shortcut jump to previous error from quickfix list
\ nnoremap <F6> :cprevious<Bar>:call Pulse()<CR>
Shortcut jump to previous error from location list
\ nnoremap <C-F6> :lprevious<Bar>:call Pulse()<CR>
Shortcut jump to next error from quickfix list
\ nnoremap <F7> :cnext<Bar>:call Pulse()<CR>
Shortcut jump to next error from location list
\ nnoremap <C-F7> :lnext<Bar>:call Pulse()<CR>
Shortcut grep for exact word under cursor
\ nnoremap <F8> *``:execute "silent grep! -w " . expand("<cword>")
\ <Bar> botright copen<CR><C-L>
Shortcut grep for word under cursor
\ nnoremap <S-F8> *``:execute "silent grep! " . expand("<cword>")
\ <Bar> botright copen<CR><C-L>
Shortcut (v) grep for visual selection
\ vnoremap <C-F8> :<C-U>GrepVisual<CR>
Shortcut only show current window
\ nnoremap <F9> :cclose<Bar>:lclose<Bar>:only<CR>
Shortcut open quickfix list window
\ nnoremap <S-F9> :copen<CR>
Shortcut open location list window
\ nnoremap <C-F9> :lopen<CR>
Shortcut switch windows
\ nnoremap <silent> <S-F10> w
nnoremap <Home> 1G
nnoremap <End> Gz-
nmap <PageUp> 0
nmap <PageDown> 0
nnoremap <Insert> [[(z<CR>]]
nnoremap <Del> j]](z<CR>]]
Shortcut! <F12> switch to previous buffer
nnoremap <F12>
imap <F2> sub ($self) {<CR>}<ESC>kea<Space>
imap <F3> $self->{}<ESC>i
imap <F4> $self->
imap <F5> [
imap <F6> ]
imap <F7> {
imap <F8> }
imap <F9> \|
imap <F10> ~
map <F13> <S-F1>
map <F14> <S-F2>
map <F15> <S-F3>
map <F16> <S-F4>
map <F17> <S-F5>
map <F18> <S-F6>
map <F19> <S-F7>
map <F20> <S-F8>
map <F21> <S-F9>
map <F22> <S-F10>
map <F23> <S-F11>
map <F24> <S-F12>
map <F25> <C-F1>
map <F26> <C-F2>
map <F27> <C-F3>
map <F28> <C-F4>
map <F29> <C-F5>
map <F30> <C-F6>
map <F31> <C-F7>
map <F32> <C-F8>
map <F33> <C-F9>
map <F34> <C-F10>
map <F35> <C-F11>
map <F36> <C-F12>
map <F37> <M-F1>
" not working with neovim
map <F38> <M-F2>
map <F39> <M-F3>
map <F40> <M-F4>
map <F41> <M-F5>
map <F42> <M-F6>
map <F43> <M-F7>
map <F44> <M-F8>
map <F45> <M-F9>
map <F46> <M-F10>
map <F47> <M-F11>
map <F48> <M-F12>
map <Leader>f1 <C-F1>
map <Leader>f2 <C-F2>
map <Leader>f8 <C-F8>
Shortcut swap with the word on the left
\ nnoremap <Leader><Left>
\ "_yiw?\v\w+\_W+%#<CR>:s/\v(%#\w+)(\_W+)(\w+)/\3\2\1/<CR><C-o><C-l>
Shortcut swap with the word on the right
\ nnoremap <Leader><Right>
\ "_yiw:s/\v(%#\w+)(\_W+)(\w+)/\3\2\1/<CR><C-o>/\v\w+\_W+<CR><C-l>
let g:undotree_WindowLayout = 1
let g:undotree_ShortIndicators = 1
let g:undotree_SetFocusWhenToggle = 1
let g:undotree_HighlightSyntaxAdd = 'CursorLine'
let g:undotree_HighlightSyntaxAdd = 'CursorLine'
let g:undotree_HighlightSyntaxChange = 'CursorLine'
Shortcut toggle undo tree
\ nnoremap <leader>gu :UndotreeToggle<CR>
Shortcut jump to previous edit location
\ nnoremap g, g;
Shortcut jump to next edit location
\ nnoremap g. g,
if has('nvim')
tnoremap <Esc> <C-\><C-n>
endif
let g:SuperTabDefaultCompletionType = '<c-n>'
let g:Gitv_CommitStep = 100
let g:Gitv_OpenHorizontal = 1
let g:Gitv_OpenPreviewOnLaunch = 1
let g:Gitv_TruncateCommitSubjects = 1
let g:Gitv_WipeAllOnClose = 1
let g:Gitv_WrapLines = 0
inoremap # X<BS>#
cnoremap <C-w> <C-I>
map! <S-Insert> <C-R>*
Shortcut (v) paste current copy buffer onto currently selected text
\ vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C-R>=current_reg<CR><Esc>
Shortcut delete trailing whitespace
\ nnoremap <leader>W :%s/\s\+$//<CR>:let @/=""<CR>
Shortcut select lines to end of previous yanked or changed text
\ nnoremap <leader>v V`]
Shortcut! cs change quotes from to
Shortcut change quotes from ' to "
\ nmap <leader>qq cs'"
Shortcut change quotes from " to '
\ nmap <leader>qQ cs"'
Shortcut toggle cursorline and cursorcolumn
\ nnoremap <Leader>ccl :set cursorline! cursorcolumn!<CR>
Shortcut show coverage information in gutter
\ nnoremap <Leader>c :source cover_db/coverage.vim<CR>
Shortcut spellcheck with British English
\ nnoremap <leader>se :setlocal spell spelllang=en_gb<CR>
Shortcut spellcheck with Swiss German
\ nnoremap <leader>sd :setlocal spell spelllang=de_ch<CR>
Shortcut turn off spellchecking
\ nnoremap <leader>so :set nospell<CR>
Shortcut toggle paste option
\ nnoremap <leader>p :set paste!<CR>
" miniyank
let g:miniyank_maxitems = 1000
let g:miniyank_filename = $HOME.'/.vim/.miniyank.mpack'
let g:miniyank_delete_maxlines = 10000
Shortcut paste with miniyank
\ map p <Plug>(miniyank-autoput)
Shortcut paste with miniyank
\ map P <Plug>(miniyank-autoPut)
Shortcut cycle forwards though miniyank buffer
\ map <C-Y> <Plug>(miniyank-cycle)
Shortcut! g- cycle backwards though miniyank buffer
" ALE
let g:ale_open_list = 0
let g:ale_echo_cursor = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_enter = 1
let g:ale_lint_on_save = 1
let g:ale_lint_delay = 200
let g:ale_set_quickfix = 0
let g:ale_sign_error = '✗'
let g:ale_sign_warning = '⚠'
let g:ale_linters = {
\ 'perl': [ 'perl' ],
\ 'rust': [ 'rls' ],
\ }
" let g:ale_linters = {'perl' : ['perl', 'syntax-check']}
" let g:ale_linters = {'perl' : ['syntax-check']}
let g:ale_perl_perl_executable = glob('~/g/base/utils/ale_perl')
let g:ale_perl_perl_options = ''
let g:ale_rust_cargo_use_clippy = 1
let g:ale_rust_cargo_check_all_targets = 1
let g:ale_rust_cargo_check_tests = 1
let g:ale_rust_cargo_use_check = 1
let g:ale_rust_rls_config = {
\ 'rust': {
\ 'clippy_preference': 'on'
\ }
\ }
let g:ale_fixers = {
\ 'rust': [ 'rustfmt' ],
\}
" Disable ale for go files
let g:ale_pattern_options = {'\.go$': {'ale_enabled': 0}}
Shortcut jump to next error
\ nmap <silent> <C-J> <Plug>(ale_next_wrap)
Shortcut jump to previous error
\ nmap <silent> <C-K> <Plug>(ale_previous_wrap)
" closetag
let g:closetag_filenames = '*.html,*.xhtml,*.tt'
" unstack
let g:unstack_populate_quickfix = 1
let g:unstack_open_tab = 0
" vim-gh-line
let g:gh_use_canonical = 0
" vim-matchup
let g:matchup_matchparen_deferred = 1
let g:matchup_delim_stopline = 50000