-
Notifications
You must be signed in to change notification settings - Fork 33
/
vimrc
4028 lines (3541 loc) · 130 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
" NOTE: this is not in sync currently with my local config currently.
" E.g. I am using vim-plug since a while since Neobundle.
scriptencoding utf-8
" Hack for left-over Vader Log commands.
com! -nargs=+ Log call neomake#utils#DebugMessage(type(<args>) == 1 ? <args> : string(<args>))
com! -nargs=* Assert echo
if 1 " has('eval') / `let` may not be available.
" Profiling. {{{
" Start profiling. Optional args: logfile-path, copy-to-@*.
fun! ProfileStart(...)
if a:0 && a:1 != 1
let g:profile_file = a:1
else
let g:profile_file = '/tmp/vim.'.getpid().'.'.reltimestr(reltime())[-4:].'profile.txt'
echom "Profiling into" g:profile_file
if a:0 < 2 || a:2
let @* = g:profile_file
endif
endif
exec 'profile start '.g:profile_file
profile! file **
profile func *
endfun
if len(get(g:, 'profile', ''))
call ProfileStart(g:profile)
endif
if 0
call ProfileStart(1, 0)
endif
" }}}
fun! MyWarningMsg(msg, ...)
let redraw = a:0 ? a:1 : !has('vim_starting')
if redraw | redraw | endif
echohl WarningMsg | echom a:msg | echohl None
endfun
" Use both , and Space as leader, but not for imap.
let mapleader = ","
nmap <space> <Leader>
vmap <space> <Leader>
nmap <space><space> <C-d>
" Try to init neobundle.
try
set rtp+=~/.vim/bundle/neobundle
let s:bundles_path = expand('~/.vim/neobundles')
call neobundle#begin(s:bundles_path)
let s:use_neobundle = 1
catch
echom "NeoBundle not found!"
echom "Error:" v:exception
let s:use_neobundle = 0
let s:bundles_path = expand('~/.vim/bundles')
endtry
let s:has_ycm = len(glob(s:bundles_path.'/YouCompleteMe/third_party/ycmd/ycm_core.*'))
let s:use_ycm = s:has_ycm
" Light(er) setup?
if exists('MyRcProfile')
if MyRcProfile ==# 'email'
" Used with External Editor addon for Thunderbird (~/bin/gvim-email).
fun! MySetupForEmail()
if exists('b:did_setup_spl_email')
return
endif
let b:did_setup_spl_email=1
let l:cursor = getcurpos()
if !search('\v%<5l^(To:|Cc:|Bcc:).*\@(\.de)@!', 'n')
" Only german recipients.
set spl=de
endif
call setpos('.', l:cursor)
endfun
augroup VimRcEmail
au!
" Not for help windows.
au FileType * if &bt == '' | call MySetupForEmail() | endif
augroup END
let MyRcProfile = 'light'
endif
else
let MyRcProfile = 'default'
endif
if s:use_neobundle " {{{
filetype off
let g:neobundle#enable_name_conversion = 1 " Use normalized names.
let g:neobundle#default_options = {
\ 'manual': { 'base': '~/.vim/bundle', 'type': 'nosync' },
\ 'colors': { 'script_type' : 'colors' } }
" Cache file: use it from tmp/tmpfs. {{{
" This helps in case the default location might not be writable (r/o
" bind-mount), and should be good for performance in general (apart from
" the first run after reboot).
let s:vim_cache = '/tmp/vim-cache-' . $USER
if !isdirectory(s:vim_cache)
call mkdir(s:vim_cache, "", 0700)
endif
" NOTE: helptags will still be rebuild always / not cached.
" Would require to overwrite neobundle#get_rtp_dir.
" https://github.com/Shougo/neobundle.vim/issues/504.
let s:cache_key = '_rc'.g:MyRcProfile.'_tmux'.executable("tmux")
\ .'_deoplete'.get(s:, 'use_deoplete', 0)
\ .'_nvim'.has('nvim')
\ .'_ruby'.has('ruby')
" Remove any previous cache files.
let s:neobundle_default_cache_file = neobundle#commands#get_default_cache_file()
let g:neobundle#cache_file = s:neobundle_default_cache_file . s:cache_key
if filereadable(s:neobundle_default_cache_file)
call delete(s:neobundle_default_cache_file)
endif
if filereadable(g:neobundle#cache_file)
call delete(g:neobundle#cache_file)
endif
let g:neobundle#cache_file = s:vim_cache.'/neobundle.cache'.s:cache_key
" }}}
if neobundle#load_cache($MYVIMRC)
" NeoBundles list - here be dragons! {{{
fun! MyNeoBundleWrapper(cmd_args, default, light)
let lazy = g:MyRcProfile == "light" ? a:light : a:default
if lazy == -1
return
endif
if lazy
exec 'NeoBundleLazy ' . a:cmd_args
else
exec 'NeoBundle ' . a:cmd_args
endif
endfun
com! -nargs=+ MyNeoBundle call MyNeoBundleWrapper(<q-args>, 1, 1)
com! -nargs=+ MyNeoBundleLazy call MyNeoBundleWrapper(<q-args>, 1, 1)
com! -nargs=+ MyNeoBundleNeverLazy call MyNeoBundleWrapper(<q-args>, 0, 0)
com! -nargs=+ MyNeoBundleNoLazyForDefault call MyNeoBundleWrapper(<q-args>, 0, 1)
com! -nargs=+ MyNeoBundleNoLazyNotForLight call MyNeoBundleWrapper(<q-args>, 0, -1)
if s:use_ycm
MyNeoBundleNoLazyForDefault 'blueyed/YouCompleteMe' , {
\ 'build': {
\ 'unix': './install.sh --clang-completer --system-libclang'
\ .' || ./install.sh --clang-completer',
\ },
\ 'augroup': 'youcompletemeStart',
\ 'autoload': { 'filetypes': ['c', 'vim'], 'commands': 'YcmCompleter' }
\ }
endif
MyNeoBundleLazy 'davidhalter/jedi-vim', '', {
\ 'directory': 'jedi',
\ 'autoload': { 'filetypes': ['python'], 'commands': ['Pyimport'] }}
" Generate NeoBundle statements from .gitmodules.
" (migration from pathogen to neobundle).
" while read p url; do \
" echo "NeoBundle '${url#*://github.com/}', { 'directory': '${${p##*/}%.url}' }"; \
" done < <(git config -f .gitmodules --get-regexp 'submodule.vim/bundle/\S+.(url)' | sort)
MyNeoBundle 'tpope/vim-abolish'
MyNeoBundle 'mileszs/ack.vim'
MyNeoBundle 'tpope/vim-afterimage'
MyNeoBundleNoLazyForDefault 'ervandew/ag'
MyNeoBundleNoLazyForDefault 'gabesoft/vim-ags'
MyNeoBundleNoLazyForDefault 'blueyed/vim-airline'
MyNeoBundleNoLazyForDefault 'vim-airline/vim-airline-themes'
MyNeoBundle 'vim-scripts/bufexplorer.zip', { 'name': 'bufexplorer' }
MyNeoBundleNoLazyForDefault 'qpkorr/vim-bufkill'
MyNeoBundle 'vim-scripts/cmdline-completion', {
\ 'autoload': {'mappings': [['c', '<Plug>CmdlineCompletion']]}}
MyNeoBundle 'kchmck/vim-coffee-script'
MyNeoBundle 'chrisbra/colorizer'
\, { 'autoload': { 'commands': ['ColorToggle'] } }
MyNeoBundle 'chrisbra/vim-diff-enhanced'
\, { 'autoload': { 'commands': ['CustomDiff', 'PatienceDiff'] } }
MyNeoBundle 'chrisbra/vim-zsh', {
\ 'autoload': {'filetypes': ['zsh']} }
" MyNeoBundle 'lilydjwg/colorizer'
MyNeoBundle 'JulesWang/css.vim'
MyNeoBundleNoLazyForDefault 'ctrlpvim/ctrlp.vim'
MyNeoBundleNoLazyForDefault 'JazzCore/ctrlp-cmatcher'
MyNeoBundle 'mtth/cursorcross.vim'
\, { 'autoload': { 'insert': 1, 'filetypes': 'all' } }
MyNeoBundleLazy 'tpope/vim-endwise', {
\ 'autoload': {'filetypes': ['lua','elixir','ruby','sh','zsh','vb','vbnet','aspvbs','vim','c','cpp','xdefaults','objc','matlab']} }
MyNeoBundle 'blueyed/cyclecolor'
MyNeoBundleLazy 'Raimondi/delimitMate'
\, { 'autoload': { 'insert': 1, 'filetypes': 'all' }}
" MyNeoBundleNeverLazy 'cohama/lexima.vim'
" MyNeoBundleNoLazyForDefault 'raymond-w-ko/detectindent'
MyNeoBundleNoLazyForDefault 'roryokane/detectindent'
MyNeoBundleNoLazyForDefault 'tpope/vim-dispatch'
MyNeoBundleNoLazyForDefault 'radenling/vim-dispatch-neovim'
MyNeoBundle 'jmcomets/vim-pony', { 'directory': 'django-pony' }
MyNeoBundle 'xolox/vim-easytags', {
\ 'autoload': { 'commands': ['UpdateTags'] },
\ 'depends': [['xolox/vim-misc', {'name': 'vim-misc'}]]}
MyNeoBundleNoLazyForDefault 'tpope/vim-eunuch'
MyNeoBundleNoLazyForDefault 'tommcdo/vim-exchange'
MyNeoBundle 'int3/vim-extradite'
MyNeoBundle 'jmcantrell/vim-fatrat'
MyNeoBundleNoLazyForDefault 'kopischke/vim-fetch'
MyNeoBundleNoLazyForDefault 'kopischke/vim-stay'
MyNeoBundle 'thinca/vim-fontzoom'
MyNeoBundleNoLazyForDefault 'idanarye/vim-merginal'
MyNeoBundle 'mkomitee/vim-gf-python'
MyNeoBundle 'mattn/gist-vim', {
\ 'depends': [['mattn/webapi-vim']]}
MyNeoBundle 'jaxbot/github-issues.vim'
MyNeoBundle 'gregsexton/gitv'
MyNeoBundleNeverLazy 'jamessan/vim-gnupg'
MyNeoBundle 'google/maktaba'
MyNeoBundle 'blueyed/grep.vim'
MyNeoBundle 'mbbill/undotree', {
\ 'autoload': {'command_prefix': 'Undotree'}}
MyNeoBundle 'tpope/vim-haml'
MyNeoBundle 'nathanaelkane/vim-indent-guides'
" MyNeoBundle 'ivanov/vim-ipython'
" MyNeoBundle 'johndgiese/vipy'
MyNeoBundle 'vim-scripts/keepcase.vim'
" NOTE: sets eventsignore+=FileType globally.. use a own snippet instead.
" NOTE: new patch from author.
MyNeoBundleNoLazyForDefault 'vim-scripts/LargeFile'
" MyNeoBundleNoLazyForDefault 'mhinz/vim-hugefile'
" MyNeoBundle 'groenewege/vim-less'
MyNeoBundleNoLazyForDefault 'embear/vim-localvimrc'
MyNeoBundle 'xolox/vim-lua-ftplugin', {
\ 'autoload': {'filetypes': 'lua'},
\ 'depends': [['xolox/vim-misc', {'name': 'vim-misc'}]]}
MyNeoBundle 'raymond-w-ko/vim-lua-indent', {
\ 'autoload': {'filetypes': 'lua'}}
if has('ruby')
MyNeoBundleNoLazyForDefault 'sjbach/lusty'
endif
MyNeoBundle 'vim-scripts/mail.tgz', { 'name': 'mail', 'directory': 'mail_tgz' }
MyNeoBundle 'tpope/vim-markdown'
MyNeoBundle 'nelstrom/vim-markdown-folding'
\, {'autoload': {'filetypes': 'markdown'}}
MyNeoBundle 'Shougo/neomru.vim'
MyNeoBundleLazy 'blueyed/nerdtree', {
\ 'augroup' : 'NERDTreeHijackNetrw' }
MyNeoBundle 'blueyed/nginx.vim'
MyNeoBundleLazy 'tyru/open-browser.vim', {
\ 'autoload': { 'mappings': '<Plug>(openbrowser' } }
MyNeoBundle 'kana/vim-operator-replace'
MyNeoBundleNoLazyForDefault 'kana/vim-operator-user'
MyNeoBundle 'vim-scripts/pac.vim'
MyNeoBundle 'mattn/pastebin-vim'
MyNeoBundle 'shawncplus/phpcomplete.vim'
MyNeoBundle '2072/PHP-Indenting-for-VIm', { 'name': 'php-indent' }
MyNeoBundle 'greyblake/vim-preview'
MyNeoBundleNoLazyForDefault 'tpope/vim-projectionist'
MyNeoBundleNoLazyForDefault 'dbakker/vim-projectroot'
" MyNeoBundle 'dbakker/vim-projectroot', {
" \ 'autoload': {'commands': 'ProjectRootGuess'}}
MyNeoBundle 'fs111/pydoc.vim'
\ , {'autoload': {'filetypes': ['python']} }
MyNeoBundle 'alfredodeza/pytest.vim'
MyNeoBundle '5long/pytest-vim-compiler'
\ , {'autoload': {'filetypes': ['python']} }
MyNeoBundle 'hynek/vim-python-pep8-indent'
\ , {'autoload': {'filetypes': ['python']} }
" MyNeoBundle 'Chiel92/vim-autoformat'
" \ , {'autoload': {'filetypes': ['python']} }
MyNeoBundleNoLazyForDefault 'tomtom/quickfixsigns_vim'
MyNeoBundleNoLazyForDefault 't9md/vim-quickhl'
MyNeoBundle 'aaronbieber/vim-quicktask'
MyNeoBundle 'tpope/vim-ragtag'
\ , {'autoload': {'filetypes': ['html', 'smarty', 'php', 'htmldjango']} }
MyNeoBundle 'tpope/vim-rails'
MyNeoBundle 'vim-scripts/Rainbow-Parenthsis-Bundle'
MyNeoBundle 'thinca/vim-ref'
MyNeoBundle 'tpope/vim-repeat'
MyNeoBundle 'inkarkat/runVimTests'
" MyNeoBundleLazy 'tpope/vim-scriptease', {
" \ 'autoload': {'mappings': 'zS', 'filetypes': 'vim', 'commands': ['Runtime']} }
MyNeoBundleNoLazyForDefault 'tpope/vim-scriptease'
MyNeoBundle 'xolox/vim-session', {
\ 'autoload': {'commands': ['SessionOpen', 'OpenSession']}
\, 'depends': [['xolox/vim-misc', {'name': 'vim-misc'}]]
\, 'augroup': 'PluginSession' }
" For PHP:
" MyNeoBundle 'blueyed/smarty.vim', {
" \ 'autoload': {'filetypes': 'smarty'}}
MyNeoBundleNeverLazy 'justinmk/vim-sneak'
MyNeoBundle 'rstacruz/sparkup'
\ , {'autoload': {'filetypes': ['html', 'htmldjango', 'smarty']}}
MyNeoBundle 'tpope/vim-speeddating'
MyNeoBundle 'AndrewRadev/splitjoin.vim'
MyNeoBundleNoLazyForDefault 'AndrewRadev/undoquit.vim'
MyNeoBundleNoLazyForDefault 'EinfachToll/DidYouMean'
MyNeoBundleNoLazyForDefault 'mhinz/vim-startify'
" After startify: https://github.com/mhinz/vim-startify/issues/33
" NeoBundle does not keep the order in the cache though.. :/
MyNeoBundleNoLazyForDefault 'tpope/vim-fugitive'
\, {'augroup': 'fugitive'}
MyNeoBundleNoLazyForDefault 'chrisbra/sudoedit.vim', {
\ 'autoload': {'commands': ['SudoWrite', 'SudoRead']} }
MyNeoBundleNoLazyForDefault 'ervandew/supertab'
MyNeoBundleNoLazyForDefault 'tpope/vim-surround'
MyNeoBundle 'kurkale6ka/vim-swap'
MyNeoBundleNoLazyForDefault "neomake/neomake"
MyNeoBundle 'vim-scripts/syntaxattr.vim'
if executable("tmux")
MyNeoBundle 'Keithbsmiley/tmux.vim', {
\ 'name': 'syntax-tmux',
\ 'autoload': {'filetypes': ['tmux']} }
MyNeoBundleNoLazyForDefault 'blueyed/vim-tmux-navigator'
MyNeoBundleNoLazyForDefault 'tmux-plugins/vim-tmux-focus-events'
MyNeoBundleNoLazyForDefault 'wellle/tmux-complete.vim'
endif
" Dependency
" MyNeoBundle 'godlygeek/tabular'
MyNeoBundle 'junegunn/vim-easy-align'
\ ,{ 'autoload': {'commands': ['EasyAlign', 'LiveEasyAlign']} }
MyNeoBundle 'majutsushi/tagbar'
\ ,{ 'autoload': {'commands': ['TagbarToggle']} }
MyNeoBundle 'tpope/vim-tbone'
MyNeoBundleNoLazyForDefault 'tomtom/tcomment_vim'
" MyNeoBundle 'kana/vim-textobj-user'
MyNeoBundleNoLazyForDefault 'kana/vim-textobj-function'
\ ,{'depends': 'kana/vim-textobj-user'}
MyNeoBundleNoLazyForDefault 'kana/vim-textobj-indent'
\ ,{'depends': 'kana/vim-textobj-user'}
MyNeoBundleNoLazyForDefault 'mattn/vim-textobj-url'
\ ,{'depends': 'kana/vim-textobj-user'}
MyNeoBundle 'bps/vim-textobj-python'
\ ,{'depends': 'kana/vim-textobj-user',
\ 'autoload': {'filetypes': 'python'}}
MyNeoBundleNoLazyForDefault 'inkarkat/argtextobj.vim',
\ {'depends': ['tpope/vim-repeat', 'vim-scripts/ingo-library']}
MyNeoBundleNoLazyForDefault 'vim-scripts/ArgsAndMore',
\ {'depends': ['vim-scripts/ingo-library']}
" MyNeoBundle 'kana/vim-textobj-django-template', 'fix'
MyNeoBundle 'mjbrownie/django-template-textobjects'
\ , {'autoload': {'filetypes': ['htmldjango']} }
MyNeoBundle 'vim-scripts/parameter-text-objects'
" paulhybryant/vim-textobj-path " ap/ip (next path w/o basename), aP/iP (prev)
" kana/vim-textobj-syntax " ay/iy
MyNeoBundle 'tomtom/tinykeymap_vim'
MyNeoBundle 'tomtom/tmarks_vim'
MyNeoBundleNoLazyForDefault 'tomtom/tmru_vim', { 'depends':
\ [['tomtom/tlib_vim', { 'directory': 'tlib' }]]}
MyNeoBundle 'vim-scripts/tracwiki'
MyNeoBundle 'tomtom/ttagecho_vim'
" UltiSnips cannot be set as lazy (https://github.com/Shougo/neobundle.vim/issues/335).
MyNeoBundleNoLazyForDefault 'SirVer/ultisnips'
" MyNeoBundle 'honza/vim-snippets'
MyNeoBundleNoLazyForDefault 'blueyed/vim-snippets'
MyNeoBundleNeverLazy 'tpope/vim-unimpaired'
MyNeoBundle 'Shougo/unite-outline'
MyNeoBundleNoLazyForDefault 'Shougo/unite.vim'
MyNeoBundle 'vim-scripts/vcscommand.vim'
MyNeoBundleLazy 'joonty/vdebug', {
\ 'autoload': { 'commands': 'VdebugStart' }}
MyNeoBundle 'vim-scripts/viewoutput'
MyNeoBundleNoLazyForDefault 'Shougo/vimfiler.vim'
MyNeoBundle 'xolox/vim-misc', { 'name': 'vim-misc' }
MyNeoBundle 'tpope/vim-capslock'
MyNeoBundle 'sjl/splice.vim' " Sophisticated mergetool.
" Enhanced omnifunc for ft=vim.
MyNeoBundle 'c9s/vimomni.vim'
MyNeoBundle 'inkarkat/VimTAP', { 'name': 'VimTAP' }
" Try VimFiler instead; vinegar maps "." (https://github.com/tpope/vim-repeat/issues/19#issuecomment-59454216).
" MyNeoBundle 'tpope/vim-vinegar'
MyNeoBundle 'jmcantrell/vim-virtualenv'
\, { 'autoload': {'commands': 'VirtualEnvActivate'} }
MyNeoBundle 'tyru/visualctrlg.vim'
MyNeoBundle 'nelstrom/vim-visual-star-search'
MyNeoBundle 'mattn/webapi-vim'
MyNeoBundle 'gcmt/wildfire.vim'
MyNeoBundle 'sukima/xmledit'
" Expensive on startup, not used much
" (autoload issue: https://github.com/actionshrimp/vim-xpath/issues/7).
MyNeoBundleLazy 'actionshrimp/vim-xpath', {
\ 'autoload': {'commands': ['XPathSearchPrompt']}}
MyNeoBundle 'guns/xterm-color-table.vim'
MyNeoBundleNoLazyForDefault 'maxbrunsfeld/vim-yankstack'
MyNeoBundle 'klen/python-mode'
" MyNeoBundle 'chrisbra/Recover.vim'
MyNeoBundleNoLazyForDefault 'blueyed/vim-diminactive'
MyNeoBundleNoLazyForDefault 'blueyed/vim-smartinclude'
" Previously disabled plugins:
MyNeoBundle 'MarcWeber/vim-addon-nix'
\, {'name': 'nix', 'autoload': {'filetypes': ['nix']}
\, 'depends': [
\ ['MarcWeber/vim-addon-mw-utils', { 'directory': 'mw-utils' }],
\ ['MarcWeber/vim-addon-actions', { 'directory': 'actions' }],
\ ['MarcWeber/vim-addon-completion', { 'directory': 'completion' }],
\ ['MarcWeber/vim-addon-goto-thing-at-cursor', { 'directory': 'goto-thing-at-cursor' }],
\ ['MarcWeber/vim-addon-errorformats', { 'directory': 'errorformats' }],
\ ]}
MyNeoBundleLazy 'szw/vim-maximizer'
\ , {'autoload': {'commands': 'MaximizerToggle'}}
" Colorschemes.
" MyNeoBundle 'vim-scripts/Atom', '', 'colors', { 'name': 'colorscheme-atom' }
MyNeoBundleNeverLazy 'chriskempson/base16-vim', '', 'colors', { 'name': 'colorscheme-base16' }
" MyNeoBundle 'rking/vim-detailed', '', 'colors', { 'name': 'colorscheme-detailed' }
" MyNeoBundle 'nanotech/jellybeans.vim', '', 'colors', { 'name': 'colorscheme-jellybeans' }
" MyNeoBundle 'tpope/vim-vividchalk', '', 'colors', { 'name': 'colorscheme-vividchalk' }
" MyNeoBundle 'nielsmadan/harlequin', '', 'colors', { 'name': 'colorscheme-harlequin' }
" MyNeoBundle 'gmarik/ingretu', '', 'colors', { 'name': 'colorscheme-ingretu' }
" MyNeoBundle 'vim-scripts/molokai', '', 'colors', { 'name': 'colorscheme-molokai' }
" MyNeoBundle 'vim-scripts/tir_black', '', 'colors', { 'name': 'colorscheme-tir_black' }
" MyNeoBundle 'blueyed/xoria256.vim', '', 'colors', { 'name': 'colorscheme-xoria256' }
" MyNeoBundle 'vim-scripts/xterm16.vim', '', 'colors', { 'name': 'colorscheme-xterm16' }
" MyNeoBundle 'vim-scripts/Zenburn', '', 'colors', { 'name': 'colorscheme-zenburn' }
" MyNeoBundle 'whatyouhide/vim-gotham', '', 'colors', { 'name': 'colorscheme-gotham' }
" EXPERIMENTAL
" MyNeoBundle 'atweiden/vim-betterdigraphs', { 'directory': 'betterdigraphs' }
MyNeoBundle 'chrisbra/unicode.vim', { 'type__depth': 1 }
MyNeoBundle 'xolox/vim-colorscheme-switcher'
MyNeoBundle 't9md/vim-choosewin'
MyNeoBundleNeverLazy 'junegunn/vim-oblique/', { 'depends':
\ [['junegunn/vim-pseudocl']]}
MyNeoBundleNoLazyForDefault 'Konfekt/fastfold'
MyNeoBundleNoLazyNotForLight 'junegunn/vader.vim', {
\ 'autoload': {'commands': 'Vader'} }
MyNeoBundleNoLazyForDefault 'ryanoasis/vim-webdevicons'
MyNeoBundle 'mjbrownie/vim-htmldjango_omnicomplete'
\ , {'autoload': {'filetypes': ['htmldjango']} }
MyNeoBundle 'othree/html5.vim'
\ , {'autoload': {'filetypes': ['html', 'htmldjango']} }
MyNeoBundleLazy 'lambdalisue/vim-pyenv'
" \ , {'depends': ['blueyed/YouCompleteMe']
" \ , 'autoload': {'filetypes': ['python', 'htmldjango']} }
" Problems with <a-d> (which is ä), and I prefer <a-hjkl>.
" MyNeoBundleNoLazyForDefault 'tpope/vim-rsi'
MyNeoBundleNoLazyForDefault 'junegunn/fzf.vim'
MyNeoBundleLazy 'chase/vim-ansible-yaml'
\ , {'autoload': {'filetypes': ['yaml', 'ansible']} }
" MyNeoBundleLazy 'mrk21/yaml-vim'
" \ , {'autoload': {'filetypes': ['yaml', 'ansible']} }
" Manual bundles.
MyNeoBundleLazy 'eclim', '', 'manual'
" \ , {'autoload': {'filetypes': ['htmldjango']} }
" MyNeoBundle 'neobundle', '', 'manual'
" NeoBundleFetch "Shougo/neobundle.vim", {
" \ 'default': 'manual',
" \ 'directory': 'neobundle', }
MyNeoBundleNeverLazy 'blueyed/vim-colors-solarized', { 'name': 'colorscheme-solarized' }
" }}}
NeoBundleSaveCache
endif
call neobundle#end()
filetype plugin indent on
" Use shallow copies by default.
let g:neobundle#types#git#clone_depth = 10
NeoBundleCheck
" Setup a command alias, source: http://stackoverflow.com/a/3879737/15690
fun! SetupCommandAlias(from, to)
exec 'cnoreabbrev <expr> '.a:from
\ .' ((getcmdtype() is# ":" && getcmdline() is# "'.a:from.'")'
\ .'? ("'.a:to.'") : ("'.a:from.'"))'
endfun
call SetupCommandAlias('NBS', 'NeoBundleSource')
if !has('vim_starting')
" Call on_source hook when reloading .vimrc.
call neobundle#call_hook('on_source')
endif
endif
endif
" Settings {{{1
set hidden
if &encoding != 'utf-8' " Skip this on resourcing with Neovim (E905).
set encoding=utf-8
endif
" Prefer unix fileformat
" set fileformat=unix
set fileformats=unix,dos
set noequalalways " do not auto-resize windows when opening/closing them!
set backspace=indent,eol,start " allow backspacing over everything in insert mode
set confirm " ask for confirmation by default (instead of silently failing)
set nosplitright splitbelow
set diffopt+=vertical
set diffopt+=context:1000000 " don't fold
set history=1000
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set nowrapscan " do not wrap around when searching.
set writebackup " keep a backup while writing the file (default on)
set backupcopy=yes " important to keep the file descriptor (inotify)
if 1 " has('eval'), and can create the dir dynamically.
set directory=~/tmp/vim/swapfiles// " // => use full path of original file
set backup " enable backup (default off), if 'backupdir' can be created dynamically.
endif
set noautoread " Enabled by default in Neovim; I like to get notified/confirm it.
set nowrap
if has("virtualedit")
set virtualedit+=block
endif
set autoindent " always set autoindenting on (fallback after 'indentexpr')
set numberwidth=1 " Initial default, gets adjusted dynamically.
" Formatting {{{
set tabstop=8
set shiftwidth=2
set noshiftround " for `>`/`<` not behaving like i_CTRL-T/-D
set expandtab
" }}}
if has('autocmd')
augroup vimrc_indent
au!
au FileType make setlocal ts=2
augroup END
augroup vimrc_iskeyword
au!
" Remove '-' and ':' from keyword characters (to highlight e.g. 'width:…' and 'font-size:foo' correctly)
" XXX: should get fixed in syntax/css.vim probably!
au FileType css setlocal iskeyword-=-:
augroup END
augroup VimrcColorColumn
au!
au ColorScheme * if expand('<amatch>') == 'solarized'
\ | set colorcolumn=80 | else | set colorcolumn= | endif
augroup END
endif
set isfname-== " remove '=' from filename characters; for completion of FOO=/path/to/file
set laststatus=2 " Always display the statusline
set noshowmode " Should be indicated by statusline (color), and would remove any echom output (e.g. current tag).
" use short timeout after Escape sequence in terminal mode (for keycodes)
set ttimeoutlen=10
set timeoutlen=2000
set updatetime=750 " Used for CursorHold and writing swap files.
" Format options {{{2
set formatoptions+=r " Insert comment leader after hitting <Enter>
set formatoptions+=o " Insert comment leader after hitting o or O in normal mode
set formatoptions+=t " Auto-wrap text using textwidth
set formatoptions+=c " Autowrap comments using textwidth
" set formatoptions+=b " Do not wrap if you modify a line after textwidth; handled by 'l' already?!
set formatoptions+=l " do not wrap lines that have been longer when starting insert mode already
set formatoptions+=q " Allow formatting of comments with "gq".
set formatoptions+=t " Auto-wrap text using textwidth
set formatoptions+=n " Recognize numbered lists
if v:version > 703 || v:version == 703 && has("patch541")
" Delete comment character when joining commented lines
set formatoptions+=j
endif
" }}}
if exists('+breakindent')
set breakindent
set breakindentopt=min:20,shift:0,sbr
endif
set linebreak " Wrap only at chars in 'breakat'.
set synmaxcol=1000 " don't syntax-highlight long lines (default: 3000)
set guioptions-=e " Same tabline as with terminal (allows for setting colors).
set guioptions-=m " no menu with gvim
set guioptions-=a " do not mess with X selection when visual selecting text.
set guioptions+=A " make modeless selections available in the X clipboard.
set guioptions+=c " Use console dialogs instead of popup dialogs for simple choices.
set guicursor& " explicitly enable it for rxvt-unicode (not in Nvim's os_term_is_nice).
let &guicursor .= ',a:blinkon0' " disable cursor blinking.
set viminfo+=% " remember opened files and restore on no-args start (poor man's crash recovery)
set viminfo+=! " keep global uppercase variables. Used by localvimrc.
if has('shada')
" Bump ' to 1000 (from 100) for v:oldfiles.
set shada=!,'1000,<50,s10,h,%,r/mnt/
endif
set selectmode=
set mousemodel=popup " extend/popup/pupup_setpos
set keymodel-=stopsel " do not stop visual selection with cursor keys
set selection=inclusive
" set clipboard=unnamed
" Do not mess with X selection by default (only in modeless mode).
if !has('nvim')
set clipboard-=autoselect
set clipboard+=autoselectml
endif
if has('mouse')
set mouse=nvi " Enable mouse (not for command line mode)
if !has('nvim')
" Make mouse work with Vim in tmux
try
set ttymouse=sgr
catch
set ttymouse=xterm2
endtry
endif
endif
set showmatch " show matching pairs
set matchtime=3
" Jump to matching bracket when typing the closing one.
" Deactivated, causes keys to be ignored when typed too fast (?).
"inoremap } }<Left><c-o>%<c-o>:sleep 500m<CR><c-o>%<c-o>a
"inoremap ] ]<Left><c-o>%<c-o>:sleep 500m<CR><c-o>%<c-o>a
"inoremap ) )<Left><c-o>%<c-o>:sleep 500m<CR><c-o>%<c-o>a
set sessionoptions+=unix,slash " for unix/windows compatibility
set nostartofline " do not go to start of line automatically when moving
" Use both , and Space as leader.
if 1 " has('eval')
let mapleader = ","
endif
" But not for imap!
nmap <space> <Leader>
vmap <space> <Leader>
" scrolloff: number of lines visible above/below the cursor.
" Special handling for &bt!="" and &diff.
set scrolloff=3
if has('autocmd')
fun! MyAutoScrollOff() " {{{
if exists('b:no_auto_scrolloff')
return
endif
if &ft == 'help'
let scrolloff = 999
elseif &buftype != ""
" Especially with quickfix (mouse jumping, more narrow).
let scrolloff = 0
elseif &diff
let scrolloff = 10
else
let scrolloff = 3
endif
if &scrolloff != scrolloff
let &scrolloff = scrolloff
endif
endfun
augroup set_scrolloff
au!
au BufEnter,WinEnter * call MyAutoScrollOff()
if exists('##TermOpen') " neovim
au TermOpen * set sidescrolloff=0 scrolloff=0
endif
augroup END
" Toggle auto-scrolloff handling.
fun! MyAutoScrollOffToggle()
if exists('b:no_auto_scrolloff')
unlet b:no_auto_scrolloff
call MyAutoScrollOff()
echom "auto-scrolloff: enabled"
else
let b:no_auto_scrolloff=1
let &scrolloff=3
echom "auto-scrolloff: disabled"
endif
endfun
nnoremap <leader>so :call MyAutoScrollOffToggle()<cr>
endif " }}}
set sidescroll=1
set sidescrolloff=10
set commentstring=#\ %s
" 'suffixes' get ignored by tmru
set suffixes+=.tmp
set suffixes+=.pyc
" set suffixes+=.sw?
" case only matters with mixed case expressions
set ignorecase smartcase
set smarttab
" NOTE: ignorecase also affects ":tj"/":tselect"!
" https://github.com/vim/vim/issues/712
if exists('+tagcase')
set tagcase=match
endif
set lazyredraw " No redraws in macros.
set wildmenu
" move cursor instead of selecting entries (wildmenu)
cnoremap <Left> <Space><BS><Left>
cnoremap <Right> <Space><BS><Right>
" consider existing windows (but not tabs) when opening files, e.g. from quickfix
" set switchbuf=useopen
" set switchbuf=split
" Display extra whitespace
" set list listchars=tab:»·,trail:·,eol:¬,nbsp:_,extends:❯,precedes:❮
" set fillchars=stl:^,stlnc:-,vert:\|,fold:-,diff:-
" set fillchars=vert:\|,fold:·,stl:\ ,stlnc:━,diff:⣿
set fillchars=vert:\ ,fold:\ ,stl:\ ,stlnc:\ ,diff:⣿
" Do not display "Pattern not found" messages during YouCompleteMe completion.
" Patch: https://groups.google.com/forum/#!topic/vim_dev/WeBBjkXE8H8
if 1 && exists(':try')
try
set shortmess+=c
" Catch "Illegal character" (and its translations).
catch /E539: /
endtry
endif
set nolist
set listchars=tab:»·,trail:·,eol:¬,nbsp:_,extends:»,precedes:«
" Experimental: setup listchars diffenrently for insert mode {{{
" fun! MySetupList(mode)
" if a:mode == 'i'
" let b:has_list=&list
" if ! &list
" " set listchars-=eol:¬
" endif
" set list
" else
" if !(exists('b:has_list') && b:has_list)
" set nolist
" endif
" " set listchars+=eol:¬
" endif
" endfun
" augroup trailing
" au!
" au InsertEnter * call MySetupList('i')
" au InsertLeave * call MySetupList('n')
" augroup END
" }}}
" Generic GUI options. {{{2
if has('gui_running')
set guioptions-=T " hide toolbar
if has('vim_starting')
" TODO: dependent on monitor size.
set lines=50 columns=90
endif
set guifont=Ubuntu\ Mono\ For\ Powerline\ 12,DejaVu\ Sans\ Mono\ 10
endif
" }}}1
" Generic mappings. {{{
" Repeat last f/t in opposite direction.
if &rtp =~ '\<sneak\>'
nmap <Leader>; <Plug>SneakPrevious
else
nnoremap <Leader>; ,
endif
nnoremap <Leader><c-l> :redraw!<cr>
" Optimize mappings on German keyboard layout. {{{
" Maps initially inspired by the intl US keyboard layout.
" Not using langmap, because of bugs / issues, e.g.:
" - used with input for LustyBufferGrep
" Not using a function to have this in minimal Vims, too.
" `sunmap` is used to use the key as-is in select mode.
map ö :
sunmap ö
map - /
sunmap -
map _ ?
sunmap _
map ü [
sunmap ü
map + ]
sunmap +
" TODO: ä
" Swap ' and ` keys (` is more useful, but requires shift on a German keyboard) {{{
noremap ' `
sunmap '
noremap ` '
sunmap `
noremap g' g`
sunmap g'
noremap g` g'
sunmap g`
" }}}
" Align/tabularize text.
vmap <Enter> <Plug>(EasyAlign)
if 1 " has('eval') / `let` may not be available.
" Maps to unimpaired mappings by context: diff, loclist or qflist.
" Falls back to "a" for args.
fun! MySetupUnimpairedShortcut()
if &diff
let m = 'c'
" diff-obtain and goto next.
nmap dn do+c
elseif len(getqflist())
let m = 'q'
elseif len(getloclist(0))
let m = 'l'
else
let m = 'n'
endif
if get(b:, '_mysetupunimpairedmaps', '') == m
return
endif
let b:_mysetupunimpairedmaps = m
" Backward.
exec 'nmap <buffer> üü ['.m
exec 'nmap <buffer> +ü ['.m
exec 'nmap <buffer> <Leader>ü ['.m
exec 'nmap <buffer> <A-ü> ['.m
" Forward.
exec 'nmap <buffer> ++ ]'.m
exec 'nmap <buffer> ü+ ]'.m
exec 'nmap <buffer> <Leader>+ ]'.m
exec 'nmap <buffer> <A-+> ]'.m
" AltGr-o and AltGr-p
exec 'nmap <buffer> ø ['.m
exec 'nmap <buffer> þ ]'.m
endfun
augroup vimrc_setupunimpaired
au!
au BufEnter,VimEnter * call MySetupUnimpairedShortcut()
augroup END
" Quit with Q, exit with C-q.
" (go to tab on the left).
fun! MyQuitWindow()
let t = tabpagenr()
let nb_tabs = tabpagenr('$')
let was_last_tab = t == nb_tabs
if &ft != 'qf' && getcmdwintype() == ''
lclose
endif
" Turn off diff mode for all other windows.
if &diff && !exists('w:fugitive_diff_restore')
WindoNodelay diffoff
endif
if &bt == 'terminal'
" 'confirm' does not work: https://github.com/neovim/neovim/issues/4651
q
else
confirm q
endif
if ! was_last_tab && nb_tabs != tabpagenr('$') && tabpagenr() > 1
tabprevious
endif
endfun
nnoremap <silent> Q :call MyQuitWindow()<cr>
nnoremap <silent> <C-Q> :confirm qall<cr>
" Use just "q" in special buffers.
if has('autocmd')
augroup vimrc_special_q
au!
autocmd FileType help,startify nnoremap <buffer> q :confirm q<cr>
augroup END
endif
" }}}
" Close preview and quickfix windows.
nnoremap <silent> <C-W>z :wincmd z<Bar>cclose<Bar>lclose<CR>
" fzf.vim {{{
" Insert mode completion
imap <Leader><c-x><c-k> <plug>(fzf-complete-word)
imap <Leader><c-x><c-f> <plug>(fzf-complete-path)
imap <c-x><c-j> <plug>(fzf-complete-file-ag)
imap <Leader><c-x><c-l> <plug>(fzf-complete-line)
let g:fzf_command_prefix = 'FZF'
let g:fzf_layout = { 'window': 'execute (tabpagenr()-1)."tabnew"' }
" TODO: see /home/daniel/.dotfiles/vim/neobundles/fzf/plugin/fzf.vim
" let g:fzf_nvim_statusline = 0
function! s:fzf_statusline()
let bg_dim = &bg == 'dark' ? 18 : 21
exec 'highlight fzf1 ctermfg=1 ctermbg='.bg_dim
exec 'highlight fzf2 ctermfg=2 ctermbg='.bg_dim
exec 'highlight fzf3 ctermfg=7 ctermbg='.bg_dim
setlocal statusline=%#fzf1#\ >\ %#fzf2#fz%#fzf3#f
endfunction
augroup vimrc_quickfixsigns
au!
autocmd FileType help,fzf,ref-* let b:noquickfixsigns = 1
if exists('##TermOpen')
autocmd TermOpen * let b:noquickfixsigns = 1
endif
augroup END
augroup vimrc_fzf
au!
autocmd User FzfStatusLine call <SID>fzf_statusline()
augroup END
" }}}
let tmux_navigator_no_mappings = 1
if has('vim_starting')
if &rtp =~ '\<tmux-navigator\>'
nnoremap <silent> <c-h> :TmuxNavigateLeft<cr>
nnoremap <silent> <c-j> :TmuxNavigateDown<cr>
nnoremap <silent> <c-k> :TmuxNavigateUp<cr>
nnoremap <silent> <c-l> :TmuxNavigateRight<cr>
" nnoremap <silent> <c-\> :TmuxNavigatePrevious<cr>
else
nnoremap <C-h> <c-w>h
nnoremap <C-j> <c-w>j
nnoremap <C-k> <c-w>k
nnoremap <C-l> <c-w>l
" nnoremap <C-\> <c-w>j
endif
endif
if exists(':tnoremap') && has('vim_starting') " Neovim
" Exit.
tnoremap <Esc> <C-\><C-n>
" <c-space> does not work (https://github.com/neovim/neovim/issues/3101).
tnoremap <C-@> <C-\><C-n>:tab sp<cr>:startinsert<cr>
let g:terminal_scrollback_buffer_size = 100000 " current max
nnoremap <Leader>cx :sp \| :term p --testmon<cr>
nnoremap <Leader>cX :sp \| :term p -k
" Add :Term equivalent to :term, but with ":new" instead of ":enew".
fun! <SID>SplitTerm(...) abort