-
Notifications
You must be signed in to change notification settings - Fork 0
/
init..vim
1397 lines (1223 loc) · 49.3 KB
/
init..vim
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
" This is the Vim(Neovim) initialization file dependent on various bundles.
" It's sourced in "init.vim".
"
" Author: Bohr Shaw <pubohr@gmail.com>
" Initialization: {{{1
let $MYBUNDLE = expand('<sfile>') " like $MYVIMRC
" Let the bundle manager download ALL bundles even if the invoked Vim binary
" doesn't have all these features.
let s:pythonx = (has('python') || has('python3'))
let s:ruby = has('ruby')
let s:lua = has('lua')
call bundle#init() " bundle initialization
" Define local mappings
augroup bundle_map | autocmd!
execute 'autocmd BufReadPost {.,}'.fnamemodify($MYBUNDLE, ':t')
\ 'call bundle#map()'
augroup END
" Meta: {{{1
" A Vim plugin for Vim plugins
call BundleRun('Tpope/vim-scriptease')
" Debugging
command! -nargs=? -complete=command VimNORC execute "Start"
\ empty(<q-args>) ? expand(exepath(v:progpath)) : <q-args>
\ '-u' expand($MYVIM.'/init.min.vim')
" Profiling
command! -nargs=? -complete=command StartupTime execute "Start"
\ empty(<q-args>) ? expand(exepath(v:progpath)) : <q-args>
\ '--startuptime startup.log +qall!' |
\ tab drop startup.log
command! -nargs=? -complete=command Profile execute "Start"
\ empty(<q-args>) ? expand(exepath(v:progpath)) : <q-args>
\ '--cmd "profile start '.getcwd().'/profile.log | profile file *"'
\ '-c "profdel file * | qall!"' |
\ tab drop profile.log
command! ProfileTabular call profile#tabular()
" Shortcuts: {{{1
" Pairs of handy bracket mappings
call BundleRun('Tpope/vim-unimpaired')
" Move lines (fix auto-closing folds)
nnoremap <silent>[e :<C-u>call b#unimpaired#move('--', v:count1)<CR>
nnoremap <silent>]e :<C-u>call b#unimpaired#move('+', v:count1)<CR>
xnoremap <silent>[e :<C-u>call b#unimpaired#move("'<--", v:count1)<CR>
xnoremap <silent>]e :<C-u>call b#unimpaired#move("'>+", v:count1)<CR>
nnoremap <silent>]d :call search('\cto-\?do:', 's')<CR>
nnoremap <silent>[d :call search('\cto-\?do:', 'sb')<CR>
nnoremap <silent>[r :set readonly<CR>
nnoremap <silent>]r :set noreadonly<CR>
nmap coP <Plug>unimpairedPaste
" Create your own submodes (e.g, g--- instead of g-g-g-)
" call BundlePath('kana/vim-submode')
" Mappings for simultaneously pressed keys
" call Bundles('kana/vim-arpeggio')
" Motion: {{{1
" The missing motion for Vim
if Bundles('Bohrshaw/vim-sneak') " 'Justinmk/vim-sneak'
" Arbitrary precise motion
nnoremap <silent> L :<C-u>call b#sneak#('', 0, '')<CR>
xnoremap <silent> L :<C-u>call b#sneak#('', 0, 'v')<CR>
onoremap <silent> L :<C-u>call b#sneak#('', 0, 'o')<CR>
nnoremap <silent> H :<C-u>call b#sneak#('', 1, '')<CR>
xnoremap <silent> H :<C-u>call b#sneak#('', 1, 'v')<CR>
onoremap <silent> H :<C-u>call b#sneak#('', 1, 'o')<CR>
" Within the current line
" Note: Don't map `f<CR>`, otherwise IME would be inactive after `f`.
NXOmap <expr>9f v#setvar('g:sneak#oneline', 1).'L'
NXOmap <expr>8f v#setvar('g:sneak#oneline', 1).'H'
" Mimic the native search command / and ?, but literal
" Function signature: sneak#wrap(op, inputlen, reverse, inclusive, label)
nnoremap <silent> z/ :<C-U>call sneak#wrap('', 99, 0, 2, 1)<CR>
nnoremap <silent> z? :<C-U>call sneak#wrap('', 99, 1, 2, 1)<CR>
xnoremap <silent> z/ :<C-U>call sneak#wrap(visualmode(), 99, 0, 2, 1)<CR>
xnoremap <silent> z? :<C-U>call sneak#wrap(visualmode(), 99, 1, 2, 1)<CR>
onoremap <silent> z/ :<C-U>call sneak#wrap(v:operator, 99, 0, 2, 1)<CR>
onoremap <silent> z? :<C-U>call sneak#wrap(v:operator, 99, 1, 2, 1)<CR>
" Repeat
nnoremap <silent>; :<C-u>call b#sneak#repeat('', 0)<CR>
xnoremap <silent>; :<C-u>call b#sneak#repeat(visualmode(), 0)<CR>
onoremap <silent>; :<C-u>call b#sneak#repeat(v:operator, 0)<CR>
nnoremap <silent>, :<C-u>call b#sneak#repeat('', 1)<CR>
xnoremap <silent>, :<C-u>call b#sneak#repeat(visualmode(), 1)<CR>
onoremap <silent>, :<C-u>call b#sneak#repeat(v:operator, 1)<CR>
let g:sneak#label = 1 " enable label mode
" let g:sneak#label_esc = "\<CR>" " key to exit label-mode
let g:sneak#absolute_dir = 1 " always go forwards or backwards when repeating
" let g:sneak#use_ic_scs = 1 " ignorecase and smartcase
" Disable highlighting
autocmd ColorScheme * hi! link Sneak Normal
hi! link SneakPluginScope Comment
" Disable default mappings
NXOmap <SID>Sneak_s <Plug>Sneak_s
NXOmap <SID>Sneak_S <Plug>Sneak_S
elseif Dundles('machakann/vim-patternjump')
let g:patternjump_no_default_key_mappings = 1
elseif Dundles('lokaltog/vim-easymotion')
let g:EasyMotion_leader_key = 'g<CR>'
elseif Dundles('goldfeld/vim-seek', 'rhysd/clever-f.vim')
let g:SeekKey = 'f<CR>'
let g:SeekBackKey = 'f<BS>'
" let g:seek_enable_jumps = 1
let g:clever_f_across_no_line = 1
endif
" Create your own text objects
if BundlePath('Kana/vim-textobj-user')
call textobj#user#plugin('file', {
\ 'file': {
\ 'pattern': '\f\+', 'select': ['af', 'if']
\ }
\ })
endif
" Text objects extended, more sensible, and corner cases handled
" Cheatsheet: $MYVIM/bundle/targets.vim/cheatsheet.md
" 'gaving/vim-textobj-argument', 'b4winckler/vim-angry', 'qstrahl/vim-dentures'
if Bundles('tommcdo/vim-ninja-feet', 'kana/vim-textobj-indent', 'machakann/vim-textobj-delimited', 'coderifous/textobj-word-column.vim')
imap <M-g><BS> <Esc>cid
" Delay activating this bundle to reduce startup time
if has('vim_starting')
if has('timers') && !has('nvim') " function() in Neovim is not patched yet
call timer_start(10, function('BundleRun', ['Wellle/targets.vim']))
else
set updatetime=10
augroup bundle_targets
autocmd CursorHold * call BundleRun('Wellle/targets.vim') |
\ set updatetime& | autocmd! bundle_targets
augroup END
endif
endif
endif
" Indent-level based motion
if Bundles('Jeetsukumaran/vim-indentwise')
map [\| <Plug>(IndentWiseBlockScopeBoundaryBegin)
map ]\| <Plug>(IndentWiseBlockScopeBoundaryEnd)
endif
" Rich line marks independent from built-in marks
if Dundles('mattesGroeger/vim-bookmarks')
let g:bookmark_sign = 'm'
let g:bookmark_annotation_sign = 'ma'
" let g:bookmark_auto_save = 0
let g:bookmark_auto_save_file = $MYTMP.'bookmark'
" let g:bookmark_highlight_lines = 1
" let g:bookmark_center = 1
nmap <Leader>tm <Plug>ToggleBookmark
nmap ma <Plug>Annotate
nmap ]m <Plug>NextBookmark
nmap [m <Plug>PrevBookmark
nmap <Leader>ml <Plug>ShowAllBookmarks
nmap <Leader>mc <Plug>ClearBookmarks
nmap <Leader>mC <Plug>ClearAllBookmarks
endif
" Search: {{{1
" Search improved
if Dundles('junegunn/vim-oblique', 'junegunn/vim-pseudocl')
endif
" Search improved
if Bundles('Haya14busa/incsearch.vim') " 'Haya14busa/vim-asterisk'
" Incremantal search improved with a search specific command line interface
NXmap g/ <Plug>(incsearch-forward)
NXmap g? <Plug>(incsearch-backward)
autocmd User Bundle call s:incsearch_mapping()
function! s:incsearch_mapping()
IncSearchNoreMap <M-j> <Over>(incsearch-next)
IncSearchNoreMap <M-k> <Over>(incsearch-prev)
IncSearchNoreMap <M-f> <Over>(incsearch-scroll-f)
IncSearchNoreMap <M-b> <Over>(incsearch-scroll-b)
IncSearchNoreMap <C-f> <Over>(incsearch-scroll-f)
IncSearchNoreMap <C-b> <Over>(incsearch-scroll-b)
IncSearchNoreMap <Tab> <Over>(buffer-complete)
IncSearchNoreMap <S-Tab> <Over>(buffer-complete-prev)
endfunction
let g:incsearch#auto_nohlsearch = 1 " auto-nohlsearch on cursor move
" Highlight only in the current window (custom hi-group instead of 'Search')
let g:incsearch#no_inc_hlsearch = 1
endif
" Grep asynchronously
if Bundles('mhinz/vim-grepper')
cnoreabbrev <expr>ge getcmdtype() == ':' && getcmdpos() == 3 ? 'Grepper -query' : 'ge'
endif
" Completion: {{{1
" Completions
if has('nvim') && Dundles('shougo/deoplete.nvim')
inoremap <expr><M-h> deoplete#manual_complete()
let g:deoplete#enable_at_startup = 1
let g:deoplete#disable_auto_complete = 1
nnoremap <expr>c\c deoplete#toggle()[1:0]
elseif s:lua && Dundles('shougo/neocomplete.vim')
let g:neocomplete#enable_at_startup = 0
let g:neocomplete#max_list = 20
let g:neocomplete#auto_completion_start_length = 2
let g:neocomplete#manual_completion_start_length = 1
" let g:neocomplete#min_keyword_length = 3
let g:neocomplete#enable_smart_case = &smartcase
" let g:neocomplete#enable_cursor_hold_i = 1
" let g:neocomplete#cursor_hold_i_time = 400 " same as swap saving interval
let g:neocomplete#lock_iminsert = 1
" let g:neocomplete#enable_prefetch = 1
let g:neocomplete#data_directory = $MYTMP.'neocomplete'
" let g:neocomplete#release_cache_time = 1800 " seconds
" Enable/disable neocomplete
nnoremap <expr> c<Leader>C neocomplete#is_enabled() ?
\ ':NeoCompleteDisable<CR>' : ':NeoCompleteEnable<CR>'
" Toggle auto/manual completion for the current buffer
nnoremap c<LocalLeader>c :NeoCompleteToggle<CR>
inoremap <C-g>cc <C-R>=neocomplete#commands#_toggle_lock()[1:0]<CR>
" Start manual completion
inoremap <silent><M-n> <C-O>:call neocomplete#init#enable() \|
\call neocomplete#commands#_lock() \|
\inoremap <silent><expr><M-n> neocomplete#start_manual_complete()<CR>
\<C-R>=neocomplete#start_manual_complete()<CR>
elseif Dundles('valloric/youcompleteme')
elseif Dundles('ervandew/supertab')
endif
" Snippet solutions
if s:pythonx && Bundle('Sirver/ultisnips', {
\ 'm': ['i <M-l>', 'x <M-l>', 'i <C-g>l',
\ 'inoremap <C-x>S <C-r>=b#ultisnips#complete()<CR>'],
\ 'c': 'UltiSnipsEdit',
\ 'f': 'snippets',
\ }, 'noftdetect') && Bundles('Honza/vim-snippets')
let g:UltiSnipsExpandTrigger='<M-l>'
let g:UltiSnipsListSnippets='<C-g>l'
let g:UltiSnipsJumpForwardTrigger='<M-j>'
let g:UltiSnipsJumpBackwardTrigger='<M-k>'
let g:UltiSnipsSnippetDirectories = ["UltiSnips", "snippet"]
let g:UltiSnipsSnippetsDir = $MYVIM.'/snippet' " personal snippets path
" let g:UltiSnipsEnableSnipMate = 0 " don't looking for SnipMate snippets
let g:UltiSnipsEditSplit = 'context'
" let g:UltiSnipsUsePythonVersion = has('python3') ? 3 : 2
" Performance
let g:UltiSnipsRemoveSelectModeMappings = 0
let b:did_after_plugin_ultisnips_after = 1 " I don't have SuperTab
elseif Dundles('garbas/vim-snipmate', 'marcweber/vim-addon-mw-utils', 'tomtom/tlib_vim', 'honza/vim-snippets')
command! -nargs=1 SImap imap <args>|smap <args>
SImap <M-j> <Plug>snipMateNextOrTrigger
xmap <M-j> <Plug>snipMateVisual
SImap <M-k> <Plug>snipMateBack
SImap <M-s> <Plug>snipMateShow
endif
let g:snips_author = 'Bohr Shaw'
let g:snips_author_email = 'pubohr@gmail.com'
" Change: {{{1
" Commenting
" 'scrooloose/nerdcommenter', 'tomtom/tcomment_vim'
if Bundles('Tpope/vim-commentary')
let commentary_map_backslash = 0 " jd
let g:tcommentMapLeader1 = '<M-c>'
let [g:tcommentMapLeader2, g:tcommentMapLeaderCommentAnyway, g:tcommentTextObjectInlineComment] = ['', '', '']
endif
" Deal with pairs of 'surroundings'
if Bundles('Tpope/vim-surround')
" :help ys
nmap s <Plug>Ysurround
nmap ss <Plug>Yssurround
nmap ds <Plug>Dsurround
nmap cs <Plug>Csurround
" :help yS
nmap gs <Plug>YSurround
nmap gss <Plug>YSsurround
nmap gcs <Plug>CSurround
" :help vS
xmap s <Plug>VSurround
xmap gs <Plug>VgSurround
" :help i_CTRL-G_s
" imap <M-s> <Plug>Isurround
imap <M-S> <Plug>ISurround
imap <C-g>s <Plug>ISurround
noremap! <expr><M-s> b#surround#()
" Surround replacements
" let g:surround_{char2nr('s')} = '`\r`' " doesn't work
let g:surround_{char2nr("\<M-9>")} = "(( \r ))"
let g:surround_{char2nr("9")} = "(( \r ))"
let g:surround_{char2nr("\<M-[>")} = "[[ \r ]]"
let g:surround_{char2nr('e')} = " \r " " e(empty) as <Space>
let g:surround_{char2nr("\<CR>")} = "\n\t\r\n"
" Won't insert indents
nmap ss<CR> sVl<CR>
" Surround targets
" Delete the nearest <Space>s around the cursor
nnoremap <silent>dse mz:execute 'keepp s/\v\s*(\S*%#\S*)\s*/\1'<Bar>
\call repeat#set("dse")<CR>g`z
let g:surround_indent = 1
let g:surround_no_mappings = 1
endif
" Provides insert mode auto-completion for quotes, parens, brackets, etc.
" call Bundles('raimondi/delimitmate', 'cohama/lexima.vim', 'jiangmiao/auto-pairs')
" Wisely add 'end' in ruby, endfunction/endif/more in vim script, etc
if Bundles('Tpope/vim-endwise')
autocmd User Bundle autocmd! endwise CmdwinEnter
endif
" Switch segments of text with predefined replacements
if Bundle('Andrewradev/switch.vim', {'c': ['Switch', 'SwitchReverse']})
nnoremap <silent>s<CR> :Switch<CR>
nnoremap <silent>s<BS> :SwitchReverse<CR>
" let g:switch_custom_definitions = []
let g:switch_mapping = ''
let g:switch_reverse_mapping = ''
endif
" Transition between multiline and single-line code
if Bundles('andrewradev/splitjoin.vim')
let g:splitjoin_split_mapping = 'cS'
let g:splitjoin_join_mapping = 'cJ'
endif
" Alignment
if Bundle('junegunn/vim-easy-align',
\ {'m': ['nx <Plug>(EasyAlign)', 'nx <Plug>(LiveEasyAlign)'],
\ 'c': ' EasyAlign'})
command! -nargs=* -range -bang Align <line1>,<line2>EasyAlign<bang> <args>
NXmap zl <Plug>(EasyAlign)
NXmap Zl <Plug>(LiveEasyAlign)
endif
if Dundles('godlygeek/tabular') " 'tommcdo/vim-lion'
AddTabularPipeline! spaces /\s/
\ map(a:lines, "substitute(v:val, ' *', ' ', 'g')") |
\ tabular#TabularizeStrings(a:lines, '\s', 'l0')
endif
" Use CTRL-A/CTRL-X to increment dates, times, and more
call Bundles('tpope/vim-speeddating')
" Exchange text flexibly with a text exchange operator
if Bundles('Tommcdo/vim-exchange')
nmap >w cxiwwcxiw
nmap <w cxiwbcxiw
nmap >W cxiWWcxiW
nmap <W cxiWBcxiW
nmap >a cxiaf,lcxia
nmap <a cxiaF,hcxia
endif
" Exchange(swap) text directly/quickly with mappings
if Dundles('kurkale6ka/vim-swap')
" let g:swap_custom_ops = []
xmap c: <plug>SwapSwapOperands
xmap c<Leader>\| <plug>SwapSwapPivotOperands
endif
" Transpose matrices of text (swap lines with columns)
call Bundles('salsifis/vim-transpose')
" Easily search for, substitute, and abbreviate multiple variants of a word
call Bundles('Tpope/vim-abolish')
" True Sublime Text style multiple selections for Vim
if Dundle('terryma/vim-multiple-cursors', {'m': ['n <C-n>', 'x <C-n>']})
" let g:multi_cursor_exit_from_visual_mode = 0
let g:multi_cursor_exit_from_insert_mode = 0
endif
" Preview contents of the registers when ", @, i_CTRL-R
" call Dundles('junegunn/vim-peekaboo')
" Make the handling of unicode and digraphs easier
call Bundle('tpope/vim-characterize', {'m': 'n ga'})
if Bundles('chrisbra/unicode.vim')
imap <C-x><M-u> <Plug>(UnicodeComplete)
imap <C-x><M-d> <Plug>(DigraphComplete)
nmap gA <Plug>(UnicodeGA)
" Disable mappings
nmap <leader>_MakeDigraph <Plug>(MakeDigraph)
nmap <leader>_UnicodeSwapCompleteName <Plug>(UnicodeSwapCompleteName)
" Duplicate commands with new names
command! -nargs=1 Unicode call unicode#PrintUnicode(<q-args>)
command! UnicodeDownload call unicode#Download(1)
endif
" Replay the edit
" call Bundles('chrisbra/replay', 'haya14busa/vim-undoreplay')
" Repeat: {{{1
" Visualize the undo tree/history
if has('nvim') ?
\ Bundle('Simnalamburt/vim-mundo', {'m': [
\ 'nnoremap <silent>c<LocalLeader>u :GundoToggle<CR>',
\ 'nnoremap <silent>c<LocalLeader>U :GundoRenderGraph<CR>']}) :
\ Bundle('Sjl/gundo.vim', {'m':
\ 'nnoremap <silent>c<LocalLeader>u :GundoToggle<CR>'})
augroup bundle_gundo | autocmd!
autocmd BufNewFile __gundo*
\ nnoremap <buffer><expr><nowait>R
\ ':let g:gundo_auto_preview = '.!g:gundo_auto_preview.
\ " <Bar> normal r<CR>"|
\ nmap <buffer><M-q> q
augroup END
let g:gundo_close_on_revert = 1 " auto-close the Gundo window
let g:gundo_auto_preview = 0
let g:gundo_playback_delay = 500
" let g:gundo_help = 0
endif
if Dundles('mbbill/undotree')
nnoremap <silent><M-b>u :UndotreeToggle<CR>
let g:undotree_SetFocusWhenToggle = 1 " cursor on the Undo window
endif
" Enable repeating supported plugin maps with '.'
call Bundles('Tpope/vim-repeat')
" A lightweight implementation of emacs's kill-ring for vim
" call Bundles('maxbrunsfeld/vim-yankstack')
" View: {{{1
" Distraction-free, hyper-focus writing
if Bundle('junegunn/goyo.vim', {'c': 'Goyo'}) &&
\ Bundle('junegunn/limelight.vim', {'c': 'Limelight'})
" let g:goyo_width = 100
let g:goyo_margin_top = 2
let g:goyo_margin_bottom = 2
" let g:goyo_linenr = 1
nnoremap <silent><C-W><M-o> :Goyo<CR>
" autocmd User GoyoEnter Limelight
" autocmd User GoyoLeave Limelight!
endif
" Resize windows using Golden Ratio (Mnemonic: golden :only)
if Bundle('roman/golden-ratio', {'m':
\ 'nmap <silent><C-w>go <Plug>(golden_ratio_toggle)'})
let g:golden_ratio_autocommand = 0
endif
" Interface: {{{1
" Fuzzy file, buffer, mru, tag, etc finder
if Dundles('ctrlpvim/ctrlp.vim')
let g:ctrlp_cache_dir = $MYTMP.'ctrlp'
" Set the mode to determine the root searching directory.
" let g:ctrlp_working_path_mode = 'ra'
" let g:ctrlp_show_hidden = 1 " scan for dotfiles and dotdirs
let g:ctrlp_follow_symlinks = 1
" let g:ctrlp_clear_cache_on_exit = 0
let g:ctrlp_max_files = 0
let g:ctrlp_lazy_update = 99 " update the match window lazily
" let g:ctrlp_by_filename = 1 " search by file name only
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\v\.(exe|so|dll)$'
\ }
" Specify an external tool to use for listing files.
let s:ctrlp_git_cmd = 'cd %s && git ls-files --cached --others --exclude-standard'
let g:ctrlp_user_command = {
\ 'types': {
\ 1: ['.git', has('win32') ? '('.s:ctrlp_git_cmd.')' : s:ctrlp_git_cmd],
\ 2: ['.hg', 'hg --cwd %s locate -I .'],
\ },
\ 'fallback': !has('win32') ?
\ 'find %s -path "*/\.*" -prune -o -type f -print -o -type l -print' :
\ executable('ag') ? 'ag -g "" %s' : ''
\ }
" Mappings inside CtrlP's prompt
let g:ctrlp_prompt_mappings = {
\ 'PrtCurLeft()': ['<C-b>'],
\ 'PrtCurRight()': ['<C-f>'],
\ 'PrtInsert()': ['<C-r>'],
\ 'PrtInsert("c")': ['<C-S-v>'],
\ 'ToggleRegex()': ['<M-r>'],
\ 'ToggleByFname()': ['<M-d>'],
\ 'PrtSelectMove("j")': ['<M-j>'],
\ 'PrtSelectMove("k")': ['<M-k>'],
\ 'MarkToOpen()': ['<M-m>'],
\ 'AcceptSelection("h")': ['<M-w>s'],
\ 'AcceptSelection("v")': ['<M-w>v'],
\ 'AcceptSelection("t")': ['<M-w>t'],
\ 'CreateNewFile()': ['<C-n>'],
\ 'ToggleType(1)': ['<M-f>'],
\ 'ToggleType(-1)': ['<M-b>'],
\ 'PrtExit()': ['<Esc>', '<C-c>', '<M-q>', '<C-g>'],
\ }
" Find project files
let g:ctrlp_map = '<M-f>p'
" Most recent used files
nnoremap <Leader>fr :CtrlPMRU<CR>
" Files with similar names
nmap <Leader>fs :let g:ctrlp_default_input = expand('%:t:r') \|
\ call ctrlp#init(0) \| unlet g:ctrlp_default_input<CR>
" Buffers
nnoremap <Leader>fb :CtrlPBuffer<CR>
" Files, buffers and MRU files at the same time
nnoremap <Leader>fa :CtrlPMixed<CR>
" Bookmarked directories
nnoremap <leader>fm :CtrlPBookmarkDir<CR>
" Clear the cache for the current search path
nnoremap <leader>fc :CtrlPClearCache<CR>
" fast matcher(especially for large projects) using python
if s:pythonx && Dundles('felikz/ctrlp-py-matcher')
let g:ctrlp_match_func = {'match': 'pymatcher#PyMatch'}
elseif Dundles('tpope/vim-haystack') " better fuzzy matching algorithm
let g:ctrlp_match_func = {'match': 'b#haystack#'}
endif
" Extensions
let g:ctrlp_extensions = []
" Navigate and jump to function defs
if Dundles('tacahiroy/ctrlp-funky')
call add(g:ctrlp_extensions, 'funky')
nnoremap <Leader>ff :CtrlPFunky<CR>
endif
" Modified files in git projects
if Dundles('jasoncodes/ctrlp-modified.vim')
nnoremap <Leader>fg :CtrlPModified<CR>
endif
endif
" Unite and create user interfaces
" call Bundles('shougo/denite.nvim')
" 'shougo/tabpagebuffer.vim', 'kopischke/unite-spell-suggest'
if DundlePath('shougo/unite.vim') &&
\ Dundles('thinca/vim-unite-history', 'shougo/neomru.vim', 'shougo/unite-outline', 'tsukkee/unite-tag', 'shougo/unite-help')
command! -nargs=* -complete=customlist,unite#complete#source U Unite <args>
command! -nargs=? -complete=customlist,unite#complete#buffer_name Ur UniteResume <args>
" The key <M-b> prefixes all mappings related to 'internal' contents
nnoremap <silent><M-b>l :Unite -buffer-name=buffer buffer<CR>
nmap <M-b>o <M-b>l
nnoremap <silent><M-b>L :Unite -direction=above -prompt-direction=above line<CR>
nnoremap <silent><M-b>O :Unite -direction=above -prompt-direction=above outline<CR>
nnoremap <silent><M-b>j :Unite jump<CR>
nnoremap <silent><M-b>c :Unite change<CR>
nnoremap <silent><M-b>r :Unite register<CR>
nnoremap <silent><M-b>h :Unite -buffer-name=help -input=.txt\ doc/ buffer:?<CR>
nnoremap <silent><M-b>H :Unite help<CR>
" The key <M-f> relates to 'external' contents
nnoremap <silent><M-f>l :Unite file:<C-r>=escape(expand('%:h'), '\')<CR><CR>
nnoremap <silent><M-f>L :Unite file<CR>
nnoremap <silent><M-f>p :call b#unite#files_project()<CR>
nnoremap <silent><M-f>r :Unite file_mru<CR>
nnoremap <silent><M-f>m :Unite bookmark<CR>
" The key <M-u> relates to utilities or Unite itself
nnoremap <silent><M-u>c :Unite history/command<CR>
nnoremap <silent><M-u>m :Unite mapping:%<CR>
nnoremap <silent><M-u>f :Unite function<CR>
nnoremap <silent><M-u>s :Unite source<CR>
nnoremap <silent><M-u>r :UniteResume<CR>
nnoremap <silent>]<M-u> :UniteNext<CR>
nnoremap <silent>[<M-u> :UnitePrevious<CR>
" Custom mappings for unite buffers
augroup bundle_unite | autocmd!
autocmd FileType unite call b#unite#map()
augroup END
call unite#custom#profile('default', 'context', {
\'start_insert': 1,
\'direction': 'belowright',
\'prompt_direction': 'below',
\'auto_resize': 1,
\})
if executable('ag')
if has('win32')
let g:unite_source_rec_async_command = ['ag', '-g', '']
endif
let g:unite_source_grep_command='ag'
let g:unite_source_grep_default_opts='--line-numbers'
let g:unite_source_grep_recursive_opt=''
endif
" call unite#filters#matcher_default#use(['matcher_fuzzy'])
" let g:unite_source_history_yank_enable = 1 " yank ring
let g:unite_data_directory = $MYTMP.'unite'
let g:neomru#file_mru_path = $MYTMP.'unite/mru/files'
let g:neomru#directory_mru_path = $MYTMP.'unite/mru/directories'
" Performance tuning
" let g:neomru#do_validate = 0 " skip checking invalide files for performance
autocmd User Bundle silent! autocmd! neomru BufEnter,VimEnter,BufWritePost
endif
" A command-line fuzzy finder
if !has('win32') &&
\ (Bundles('junegunn/fzf') ||
\ isdirectory($HOME.'/.fzf/plugin') && rtp#add('~/.fzf')) &&
\ Bundles('junegunn/fzf.vim')
let g:fzf_command_prefix = ''
nnoremap <silent><M-f>l :call fzf#vim#files(expand('%:h'), 0)<CR>
nnoremap <silent><M-f>L :Files<CR>
nnoremap <silent><M-f>g :GitFiles<CR>
nnoremap <silent><M-f>s :GitFiles?<CR>
nnoremap <silent><M-f>r :History<CR>
nnoremap <silent><M-b>l :Buffers<CR>
nnoremap <silent><M-b>m :Marks<CR>
imap <C-x>F <plug>(fzf-complete-path)
imap <expr><C-x>K b#fzf#dict()
let g:fzf_action = {
\ 'ctrl-s': 'split',
\ 'ctrl-v': 'vsplit',
\ 'ctrl-t': 'tab split',
\ 'alt-t': '-tab split',
\ }
let $FZF_DEFAULT_OPTS = '--exact --multi --cycle'
endif
" A tree explorer plugin for vim
if Dundle('scrooloose/nerdtree', {'m': [
\ 'nnoremap c<Leader>d :NERDTreeToggle<CR>',
\ 'nnoremap <leader>dd :NERDTree<CR>',
\ 'nnoremap <leader>df :NERDTreeFind<CR>']})
let NERDTreeHijackNetrw=0 " don't replace netrw
let NERDTreeBookmarksFile=$MYTMP.'NERDTreeBookmarks'
let NERDTreeIgnore=['^\.$', '^\.\.$', '\~$', '\.pyc$', '\.swp$']
let NERDTreeShowHidden=1
let NERDTreeShowBookmarks=1
let NERDTreeQuitOnOpen=1
let NERDTreeMouseMode=2
endif
" A minimalist directory viewer intended to be composable
if Bundles('Justinmk/vim-dirvish')
nmap <silent><M-f>h :<C-u>Dirvish %:p<C-r>=repeat(':h',v:count1)<CR><CR>
nmap <M--> <M-f>h
nmap <silent><M-f>. :Dirvish<CR>
autocmd User Bundle nunmap -
elseif Dundles('tpope/vim-vinegar') " 'jeetsukumaran/vim-filebeagle'
nmap <M-f>h <Plug>VinegarUp
autocmd User Bundle nunmap -
endif
" Project configuration
" call Bundles('tpope/vim-projectionist')
" Buffer Explorer/Browser
" call Bundles('vim-scripts/bufexplorer.zip', 'jeetsukumaran/vim-buffergator')
" Workflow: {{{1
" Session management
if Bundles('bohrshaw/vim-mansion') " 'tpope/vim-obsession'
let g:sessiondir = $MYVIM.'/session'
" let g:mansion_no_auto_save = 1
" let g:mansion_no_maps = 1
elseif Dundles('mhinz/vim-startify')
let g:startify_session_dir = $MYVIM.'/session'
let g:startify_list_order = ['sessions', 'bookmarks', 'files']
let g:startify_skiplist = ['[Vv]im.*[\/]doc[\/][^\/]\+\.txt']
let g:startify_custom_header = [
\ ' _ /|',
\ " \\'o.O'",
\ ' =(___)=',
\ ' U ʕϴϖϴʔ',
\ ''
\ ]
" Prevent CtrlP open a split
augroup bundle_startify | autocmd!
autocmd FileType startify setlocal nospell buftype=
augroup END
endif
" Appearance: {{{1
" Color Schemes
if Bundles('Bohrshaw/vim-colors', 'Chriskempson/base16-vim')
autocmd User Bundle nested execute 'silent color'
\ has('nvim') || has('gui_running') || !has('win32') ?
\ &background == 'light' ? 'seoul256' : 'seoul256' :
\ ''
augroup bundle_colors | autocmd!
autocmd ColorScheme * call b#colors#()
augroup END
let g:seoul256_background = 233
let g:gruvbox_italic = 0
let g:solarized_italic = 0
let g:solarized_underline = 0
let g:solarized_termcolors = &term =~ '256col' ? 256 : 16
let g:solarized_menu=0
endif
" All 256 xterm colors with their RGB equivalents, right in Vim!
if Bundle('guns/xterm-color-table.vim', {'c': 'XtermColorTable'})
" Try local maps: t, f, #
command! ColorTable XtermColorTable
let g:XtermColorTableDefaultOpen = 'edit'
endif
" A powerful color tool
" call Bundles('rykka/colorv.vim')
" Make gvim-only colorschemes work transparently in terminal vim
" call Bundles('godlygeek/csapprox')
" Enhances Vim's integration with the terminal in several ways
if !has('gui_running') && Dundles('wincent/terminus')
endif
" Lean & mean statusline for vim that's light as air
if Dundles('bling/vim-airline')
" Remove separators, the different colors already make it easy to distinguish.
let [g:airline_left_sep, g:airline_right_sep] = ['', '']
" let g:airline_paste_symbol = 'P'
let g:airline_section_z = '%l,%c %p%%' "right side section
" Use shorter modes indicators
let g:airline_mode_map = { '__': '-', 'n': 'N', 'i': 'I', 'R': 'R', 'c': 'C',
\ 'v': 'V', 'V': 'VL', '': 'VB', 's': 'S', 'S': 'SL', '': 'SB'}
" Extensions
" Disable showing a summary of changed hunks under source control.
let g:airline#extensions#hunks#enabled = 0
" Showing only non-zero hunks.
let g:airline#extensions#hunks#non_zero_only = 1
" Disable detection of whitespace errors.
let g:airline#extensions#whitespace#enabled = 0
" Disable tagbar integration.
let g:airline#extensions#tagbar#enabled = 0
endif
" Super simple vim plugin to show the list of buffers in the command bar
" call Bundles('bling/vim-bufferline')
" Toggle, display and navigate marks
if Dundles('kshenoy/vim-signature')
let g:SignatureEnabledAtStartup = 0
let g:SignatureMenu = 0
endif
" Displaying indent levels visually
if Bundle('yggdroot/indentline', {'m':
\ 'nnoremap <silent>c<LocalLeader>d :IndentLinesToggle<CR>'})
" 'nathanaelkane/vim-indent-guides'
let g:indentLine_enabled = 0
let g:indentLine_fileTypeExclude = ['help']
let g:indentLine_noConcealCursor = ''
" let g:indentLine_fileType = ['rb']
" let g:indentLine_faster = 1
" let g:indentLine_char = '┊' " |│¦┆┊
endif
" Toggle full screen
if has('win32')
if Dundle('bohrshaw/wimproved.vim:', {'c': 'WToggleFullscreen'})
" 'kkoenig/wimproved.vim'
command! FullScreen WToggleFullscreen
elseif executable('gvimfullscreen.dll')
command! FullScreen call libcallnr('gvimfullscreen.dll', "ToggleFullScreen", 0)
endif
endif
" Neovim-qt: helper GUI commands and functions (bundled in ginit.vim)
Nop call Bundles('equalsraf/neovim-gui-shim')
" FileTypes: {{{1
" A collection of language packs
" call Bundle('sheerun/vim-polyglot')
" Tools {{{2
" Syntax checking hacks for vim
if 0 && Dundles('vim-syntastic/syntastic')
let g:syntastic_mode_map = { 'mode': 'active',
\ 'active_filetypes': [],
\ 'passive_filetypes': [] }
let g:syntastic_auto_loc_list = 0
" let g:syntastic_always_populate_loc_list = 1
" let g:syntastic_auto_jump = 3 " auto-jump to the first error
elseif Bundles('neomake/neomake')
command! -nargs=* -bang -bar -complete=customlist,neomake#CompleteMakers M
\ Neomake<bang> <args>
augroup bundle_neomake | autocmd!
autocmd BufWritePost * Neomake
autocmd BufWinEnter * call neomake#ProcessCurrentWindow()
autocmd User Bundle autocmd! neomake
augroup END
nnoremap <silent>sm :call neomake#EchoCurrentError()<CR>
elseif Dundles('w0rp/ale')
endif
" Format codes with external code formatters
if Bundle('sbdchd/neoformat', {'c': 'Neoformat'})
endif
if Bundle('chiel92/vim-autoformat', {'c': 'Autoformat'})
endif
" Vim plugin that displays tags in a window, ordered by class etc
if Bundle('majutsushi/tagbar', {'m': [
\ 'nnoremap <silent>c<Leader>t :TagbarToggle<CR>',
\ 'nnoremap <silent>c<Leader>T :TagbarTogglePause<CR>']})
let g:tagbar_map_toggleautoclose = "C"
let g:tagbar_autoclose = 1
let g:tagbar_map_preview = "p"
let g:tagbar_map_showproto = "i"
let g:tagbar_map_hidenonpublic = "P"
let g:tagbar_map_togglesort = "S"
let g:tagbar_sort = 0
let g:tagbar_map_zoomwin = "X"
let g:tagbar_zoomwidth = 0
let g:tagbar_compact = 1
let g:tagbar_foldlevel = 2
endif
" Documentation/reference viewer
if Bundle('keithbsmiley/investigate.vim',
\ {'m': 'nnoremap <silent>gK :call investigate#Investigate()<CR>'})
endif
if Dundles('thinca/vim-ref')
let g:ref_no_default_key_mappings = 1
nmap gK <Plug>(ref-keyword)
xmap gK <Plug>(ref-keyword)
endif
" Reference docs using an external tool 'zeal' (poor VimL)
if Bundle('KabbAmine/zeavim.vim', {'m': 'nnoremap <silent>zK :Zeavim<CR>'})
" Or set a local docset with :Docset which actually just set b:manualDocset
let g:zv_added_files_type = {
\ 'python': 'python 3',
\ 'ruby': 'ruby 2',
\ }
let g:zv_disable_mapping = 1
endif
" Dispatch.vim: asynchronous build and test dispatcher
call Bundles('tpope/vim-dispatch')
" Run Async Shell Commands in Vim 8.0
if Bundles('skywind3000/asyncrun.vim')
command! -nargs=+ -complete=shellcmd B AsyncRun! <args>
" Override the command provided by "vim-dispatch" to make :Gpull asynchronous
autocmd User Bundle command! -bang -nargs=* -complete=file
\ Make AsyncRun -program=make @ <args>
let g:statusline.2 = "%{&showtabline==1&&tabpagenr('$')>1||&showtabline==2?'':g:asyncrun_status}"
let g:tabline.2 = "%{g:asyncrun_status}"
endif
" Execute whole/part of editing file
if Bundles('thinca/vim-quickrun')
command! -nargs=* -range=% -complete=customlist,quickrun#complete Run
\ call quickrun#command(<q-args>, <count>, <line1>, <line2>)
nmap R <Plug>(quickrun-op)
xnoremap <silent>R :Run -mode v<CR>
nnoremap <silent>Rr :.Run -mode n<CR>
nnoremap <silent>RR :Run -mode n<CR>
" Echo the value of an expression, or preview markdown
nnoremap <silent>Re :set operatorfunc=run#eval<CR>g@
nnoremap <silent>RE :Preview<CR>
xnoremap <silent>gR "zy:call run#eval('v')<CR>
" Preview markdown in a browser
command! -nargs=* -range=% -complete=customlist,quickrun#complete Preview
\ <line1>,<line2>Run -type markdown_preview
" Configure the runner for various file types.
" See the value of g:quickrun#default_config for examples.
let g:quickrun_config = {
\ '_': {'outputter': 'message'},
\
\ 'sh': {'command': 'bash'},
\ 'lua': {'command': executable('luajit') ? 'luajit' : 'lua'},
\
\ 'markdown': {'type':
\ executable('pandoc') ? 'markdown/pandoc' :
\ executable('cmark') ? 'markdown/cmark' :
\ executable('redcarpet') ? 'markdown/redcarpet' :
\ ''},
\ 'markdown_preview': {
\ 'type': executable('pandoc') ? 'markdown/pandoc_highlight' : 'markdown',
\ 'outputter': 'browser',
\ },
\ 'markdown/pandoc': {'command': 'pandoc',
\ 'cmdopt': '--from markdown_github --no-highlight',
\ },
\ 'markdown/pandoc_highlight': {'command': 'pandoc',
\ 'cmdopt': '--from markdown_github --standalone',
\ },
\ 'markdown/cmark': {'command': 'cmark',
\ 'cmdopt': '--hardbreaks',
\ },
\ }
if empty(g:quickrun_config.markdown.type)
call remove(g:quickrun_config, 'markdown')
endif
let g:quickrun_no_default_key_mappings = 1
endif
" Run code on codepad.org
if Bundle('mattn/codepad-vim', {'m': [
\ 'nnoremap <Leader>R :CodePadRun<CR>',
\ 'xnoremap <Leader>R :CodePadRun<CR>']})
endif
" Rainbow Parentheses
if Bundle('junegunn/rainbow_parentheses.vim', {
\ 'm': 'nnoremap <silent>c<LocalLeader>r :call rainbow_parentheses#toggle()<CR>',
\ 'c': 'RainbowParentheses'})
augroup bundle_rainbow_parentheses | autocmd!
autocmd FileType lisp,clojure,scheme RainbowParentheses
augroup END
" let g:rainbow#pairs = [['(', ')'], ['[', ']']]
" List of colors that you do not want. ANSI code or #RRGGBB
" let g:rainbow#blacklist = [233, 234]
" let g:rainbow#max_level = 12
endif
" Markups {{{2
" HTML5 omnicomplete and syntax
call Bundle('othree/html5.vim', {'f': 'html'})
" Runtime files for Haml, Sass, and SCSS
call Bundle('tpope/vim-haml', {'f': 'haml,sass,scss'})
" XML
let g:xml_syntax_folding = 1
" Runtime files for LESS (dynamic CSS)
call Bundle('groenewege/vim-less', {'f': 'less'})
" Improves HTML & CSS workflow: http://emmet.io
if Bundle('mattn/emmet-vim', {'m': 'i <C-x>e'}) " rstacruz/sparkup
let g:user_emmet_mode='i' " only enabled in insert mode
let g:user_emmet_leader_key = '<C-x>e' " mnemonic of 'expand'
" let g:user_emmet_install_global = 0 " enabled only for certain file types
" autocmd bundle FileType html,css EmmetInstall
endif
" Markdown runtime files
if Bundle('tpope/vim-markdown', {'f': 'markdown'})
let g:markdown_folding = 1
endif
" Preview various markup files with external tools
" Note: This is superseded by QuickRun.
if Dundles('greyblake/vim-preview') " 'matthias-guenther/hammer.vim'
nnoremap <silent>RE :Preview<CR>
autocmd User Bundle nunmap <Leader>P
" The markdown rendering gem 'redcarpet' is unavailable on Windows
if has('win32')
autocmd User Bundle command! -range=% PreviewMarkdown
\ call markdown#preview(<line1>, <line2>)
nnoremap <silent><expr>RE ':Preview'.
\ (&filetype == 'markdown' ? 'Markdown' : '')."<CR>"
endif
endif
" Javascript {{{2
if Bundles('pangloss/vim-javascript', 'ternjs/tern_for_vim')
let g:tern_show_argument_hints = 1
let g:tern_show_signature_in_pum = 1
endif
" CoffeeScript support for vim
call Bundle('kchmck/vim-coffee-script', {'f': 'coffee'})
" CFamily {{{2
if Bundle('rust-lang/rust.vim', {'f': 'rust'})
let g:rust_fold = 1 " folds are defined but opened
" let g:rust_conceal = 1
augroup bundle_rust | autocmd!
autocmd FileType rust
\ nnoremap <buffer>RR :RustRun<CR>|
\ nnoremap <buffer>R<Space> :RustRun
augroup END
endif
" Golang {{{2
if Bundles('fatih/vim-go')
nnoremap <expr>g<LocalLeader> ':Go'.toupper(v#getchar())
let g:go_auto_type_info = 0
let g:go_fmt_autosave = 0
" let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck']
let g:go_dispatch_enabled = 0
let g:go_highlight_string_spellcheck = 0
let g:go_highlight_trailing_whitespace_error = 0 " covered by 'listchars'
let g:go_term_mode = "split"
augroup bundle_go | autocmd!
autocmd FileType godoc nnoremap <buffer>q <C-W>q
" For :GeDoc
autocmd BufReadCmd godoc://*
\ nmap <buffer><CR> <C-]>|
\ nmap <buffer><BS> <C-t>|
\ nmap <buffer><LocalLeader>p <C-a>|
\ nnoremap <buffer>q <C-w>q|
\ stopinsert