-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
1296 lines (1284 loc) · 31.6 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
" ViMproved {{{
"
"
"
se nocompatible
se encoding=utf-8
scriptencoding utf-8
filet off
" }}}
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Author: Mohamed Boughaba "
" Repository: https://github.com/mboughaba/dotfiles "
" Description: My own taste of dotfiles "
" ╔╗ ┌─┐ ┬╔╦╗┌─┐┬─┐┌─┐┬ ┬┌─┐┌┬┐ "
" ╠╩╗├┤ │║║║├─┘├┬┘│ │└┐┌┘├┤ ││ "
" ╚═╝└─┘ ┴╩ ╩┴ ┴└─└─┘ └┘ └─┘─┴┘ "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Map Leader {{{
"
"
"
" Map leader key to space
let g:mapleader=" "
" }}}
" Plug {{{
"
"
"
" Specify a directory for plugins
" - Avoid using standard Vim directory names like 'plugin'
cal plug#begin('~/.vim/plugged')
"
" Custom Plugins
"
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'felikz/ctrlp-py-matcher'
Plug 'majutsushi/tagbar', { 'on': 'TagbarToggle' }
Plug 'mbbill/undotree', { 'on': 'UndotreeToggle' }
Plug 'mboughaba/vim-lessmess'
"Plug 'mileszs/ack.vim', { 'on': [
Plug 'mboughaba/ack.vim', { 'on': [
\ 'Ack',
\ 'AckWindow',
\ 'AckFromSearch',
\ 'LAck',
\ 'LAckWindow',
\ 'LAckFromSearch'] }
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree'
Plug 'terryma/vim-multiple-cursors'
Plug 'terryma/vim-smooth-scroll'
Plug 'tpope/vim-projectionist'
Plug 'vim-airline/vim-airline' | Plug 'vim-airline/vim-airline-themes'
Plug 'octol/vim-cpp-enhanced-highlight', { 'for': ['cpp', 'c'] }
Plug 'junegunn/goyo.vim', { 'on': 'Goyo' }
Plug 'altercation/vim-colors-solarized'
Plug 'mboughaba/i3config.vim', { 'for': 'i3config' }
Plug 'syngan/vim-vimlint' | Plug 'ynkdir/vim-vimlparser'
Plug 'vim-scripts/BufOnly.vim'
if empty($opendev)
Plug 'mhinz/vim-startify'
Plug 'Chiel92/vim-autoformat'
Plug 'Quramy/tsuquyomi', { 'for': 'typescript' }
Plug 'ap/vim-css-color'
Plug 'digitaltoad/vim-pug', { 'for': 'pug' }
Plug 'elzr/vim-json', { 'for': 'json' }
Plug 'cakebaker/scss-syntax.vim', { 'for': 'scss' }
Plug 'hail2u/vim-css3-syntax', { 'for': ['javascript', 'css', 'html'] }
Plug 'isRuslan/vim-es6', { 'for': ['javascript', 'css', 'html'] }
Plug 'leafgarland/typescript-vim', { 'for': 'typescript' }
Plug 'marcweber/vim-addon-mw-utils', { 'for': ['javascript', 'css', 'html'] }
Plug 'ternjs/tern_for_vim', { 'for': ['javascript', 'css', 'html'] }
Plug 'othree/html5.vim', { 'for': ['javascript', 'css', 'html'] }
Plug 'pangloss/vim-javascript', { 'for': ['javascript', 'css', 'html'] }
Plug 'scrooloose/syntastic'
" NOTE: Switch to ale when tsuquyomi support is available
" Plug 'w0rp/ale'
Plug 'prettier/vim-prettier', {
\ 'do': 'npm install',
\ 'for': ['javascript', 'typescript'] }
Plug 'shougo/vimproc.vim', { 'for': ['typescript', 'javascript', 'css', 'html'] }
Plug 'tomtom/tlib_vim', { 'for': ['javascript', 'css', 'html'] }
Plug 'vim-scripts/Flex-Development-Support', { 'for': 'actionscript' }
Plug 'chrisbra/vim-autoread'
Plug 'editorconfig/editorconfig-vim'
Plug 'mattn/emmet-vim', { 'for': ['typescript', 'javascript', 'css', 'html'] }
Plug 'heavenshell/vim-jsdoc', { 'for': ['typescript', 'javascript'] }
Plug '~/def.vim', { 'for': 'def' }
el
Plug '~/prj/tts.vim', { 'for': 'tts' }
Plug '~/prj/ttser', { 'for': 'tts' }
en
if has("win32")
Plug 'derekmcloughlin/gvimfullscreen_win32'
Plug 'vim-scripts/zoom.vim'
elsei has("unix") && has("python")
Plug 'valloric/youcompleteme'
en
"
" Disabled plugs
"
" NOTE: This plugin is more annoying than anything else
" Plug 'airblade/vim-gitgutter'
" NOTE: This plugin doesn't work,
" it has very strange display issues on scroll
" Plug 'kkoenig/wimproved.vim'
" Plug 'tpope/vim-fugitive'
" Plug 'Shutnik/jshint2.vim', { 'for': ['javascript', 'css', 'html'] }
" Plug 'groenewege/vim-less', { 'for': 'less' }
" Plug 'maksimr/vim-jsbeautify', { 'for': ['javascript', 'css', 'html'] }
" Plug 'hushicai/tagbar-javascript.vim', { 'for': ['javascript', 'css', 'html'] }
" Plug 'junegunn/vader.vim', { 'for': 'vader' }
" Plug 'm42e/vim-gcov-marker'
" Plug 'mattn/webapi-vim'
" Plug 'mboughaba/edifact.vim', { 'for': 'edi' }
" Plug 'will133/vim-dirdiff'
"
" Let there be dragons
"
" Initialize plugin system
cal plug#end()
filet plugin indent on
" }}}
" Eye Candy {{{
"
"
"
" Color
"
if has("gui_running")
se guioptions-=T
se guioptions-=m
se guioptions-=r
"remove menu bar
se guioptions-=m
"remove left-hand scroll bar
se guioptions-=L
se guifont=Source_Code_Pro_for_Powerline:h9:cANSI:qDRAFT
se lines=999 columns=999
se guioptions=icpM
if has('win32') || has('win64')
map <Leader>11 <Esc>:cal libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)<CR>
" Improve rendering in GViM
if (v:version == 704 && has("patch393")) || v:version > 704
se renderoptions=type:directx,level:0.75,gamma:1.25,contrast:0.25,
\geom:1,renmode:5,taamode:1
en
en
el
" Force 256 colors
se t_Co=256
en
"
" Cursor, Line & Sign
"
fun! s:patch_colorscheme()
if !&diff
" Line number column same background as vim itself
hi clear LineNr
" Vertical split line same background as vim itself
hi clear VertSplit
" Sign column same background as line numbers
hi clear SignColumn
" Hide '~' character at the end of buffer
hi EndOfBuffer ctermfg=240 guifg=bg
" customize linenr on gui only
hi LineNr guifg=#d78787
hi SignColumn guibg=bg
" Make cursor stand out
hi Cursor ctermbg=198 guibg=#D13A82
hi iCursor ctermbg=201 guibg=#D13A82
se guicursor=n-v-c:block-Cursor
se guicursor+=i:ver100-iCursor
se guicursor+=n-v-c:blinkon0
se guicursor+=i:blinkwait10
en
endf
"
" Colorscheme
"
" Enable syntax highlighting
syn enable
" Dark background color (default)
se bg=dark
" Set color scheme
" Solarized Support transparent terminal emulators
let g:solarized_italic = 0
let g:solarized_contrast = "low"
let g:solarized_termtrans = 1
let g:solarized_termcolors = 256
let g:solarized_visibility = "high"
" Switch colorscheme between morning and late hours :X
" @vimlint(EVL103, 1, a:timer)
fun! SwitchBackground(timer)
let l:hour = strftime("%H")
if l:hour >= 6 && l:hour < 16
if &bg == "dark"
let g:solarized_contrast = "high"
se bg=light
en
el
if &bg == "light"
let g:solarized_contrast = "normal"
se bg=dark
en
en
endf
" @vimlint(EVL103, 0, a:timer)
cal SwitchBackground(0)
let g:bgSwitcherTimer = timer_start(3600000, 'SwitchBackground', {'repeat': -1})
colo solarized
" Apply colorscheme changes
cal s:patch_colorscheme()
" }}}
" Vim Settings {{{
"
"
"
" Display tooltip (used for typescript)
"
se ballooneval
"
" Splits
"
" Open new split panes to right and bottom
se splitbelow
se splitright
"
"
" Make vim find search in subdirectories
"
se path+=**
"
" Show menu
"
se wildmenu
"
" Hide buffers
"
se hidden
" Show current command
se showcmd
" Show current mode
se showmode
if has("gui_running")
se rop=type:directx,gamma:1.0,contrast:0.5,level:1,geom:1,renmode:4,taamode:1
en
if &modifiable
" Use unix style line endings
se ff=unix
en
"
" Show ruler
"
se ruler
"
" Auto reload
"
se autoread
"
" Fast terminal
"
se ttyfast
" Load non default configuration
" Force vim to source vimrc if present in working directory.
se exrc
" Restrict write & shell commands when non-default vimrc.
se secure
"
" Temp Files
"
" No backup file
se nobackup
" No swap file
se noswapfile
"
" vim v7.3+ specific options
"
if version >= 703
" Undo
" Persistent undo
se undofile
" Location to store undo history
se undodir=~/.vim/undo
" Maximum number of changes
se undolevels=1000
" Maximum number of lines to save for undo on a buffer reload
se undoreload=10000
" Joining
" Delete comment character when joining commented lines
se formatoptions+=j
" Dont continue comments when pushing o/O
set formatoptions-=o
" Line Numbers
" Relative line numbers, no thanks :)
se rnu
en
"
" Line Numbers
"
" Show line numbers
se nu
"
" Scrolling
"
" Keep at least 5 lines above/below
se scrolloff=5
" Keep at least 5 columns left/right
se sidescrolloff=5
"
" Searching
"
" Incremental search
se incsearch
" Highlight matches
se hlsearch
" Case-insensitive search
se ignorecase
" Unless search contains uppercase letter
se smartcase
" Show matching bracket
se showmatch
" Searches wrap around the end of the file.
se wrapscan
if has("gui_running")
" Hack to make multiple cursor highlight word properly in gvim
se selection=inclusive
en
"
" Indentation
"
" Better tabs
se smarttab
" Inserts new level of indentation
se smartindent
" Copy indentation from previous line
se autoindent
" Columns a tab counts for
se tabstop=2
" Columns a tab inserts in insert mode
se softtabstop=2
" Columns inserted with the re-indent operations
se shiftwidth=2
" Always indent by multiple of shift width
se shiftround
" Always use spaces instead of tabs
se expandtab
"
" Joining
"
" Only one space when joining lines
se nojoinspaces
" Key sequence timeout
" Enable time out
se ttimeout
" Set timeout time to 80 ms
se ttimeoutlen=80
" Backspace Delete over line breaks
se backspace=indent,eol,start
"
" Mouse
"
" Hide mouse when typing
se mousehide
" No visual selection from using mouse
se mouse=nicr
" Always display sign column
se signcolumn=yes
"
" Wrapping
"
" Enable better wrapping
se wrap
" When wrapping, only at certain characters
se linebreak
" Turn off physical line wrapping
se textwidth=0
se wrapmargin=0
" Make sure soft line break is done properly.
se nolist
" Customized characters to be shown when list is on
se listchars=tab:▸\ ,trail:·,extends:❯,precedes:❮,nbsp:⎵,eol:¬
" String at start of lines that have been wrapped.
se showbreak=↳
"
" Completion Menu
"
" Inserts the longest common text and show menu even with only one item
se completeopt=longest,menuone
"
" Paste
"
se pastetoggle=<Leader>2
"
" Spell
"
" Default language
se spelllang=en_us
" Word completion
se complete+=kspell
"
" Disable Bells
"
se noeb vb t_vb=
"
" Ctags Find .tags recursively
"
se tags=.tags;
" In large projects with so many dependencies, working with cscope is just too
" much for a humain being to deal with.
" Maybe I am using cscope the wrong way, TODO: find a better use of cscope.
"if has("cscope")
" " use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t'
" se cscopetag
" " check cscope for definition of a symbol after checking ctags: set to 0
" " if you want the reverse search order.
" se csto=1
" " add any cscope database in current directory
" if filereadable("cscope.out")
" cs add cscope.out
" en
" " show msg when any other cscope db added
" se cscopeverbose
"en
"
" Statusline
"
" Always display status line
se laststatus=2
" Excluding version control directories
se wildignore+=*/.git/*,*/.hg/*,*/.svn/*
se wildignore+=*/.res,*/.rex,*/.log,*/.playconf,*/.gsvconf,*/.tags,*/cscope.*
"
" Display less
"
if !&diff
" Hide showmode as we are uing statusline plugin
se noshowmode
el
" Hide line number in diff mode
se nonu
en
"
" Configure statusline for later Syntastic use
"
if !&diff
se statusline+=%#warningmsg#
if exists(":SyntasticStatuslineFlag") | se statusline+=%{SyntasticStatuslineFlag()} | en
se statusline+=%*
en
"
" Typos
"
cnorea W w
cnorea Q q
"
" Grep vs Ag
"
if executable('ag')
" Use ag over grep
se grepprg=ag\ --nogroup\ --nocolor
en
"
" Copy from GViM
"
if has("gui_running")
se clipboard=unnamedplus
en
" }}}
" Plugin Settings {{{
"
"
"
" Startify
"
let g:startify_change_to_dir = 1
let g:startify_change_to_vcs_root = 1
let g:startify_enable_special = 1
let g:startify_files_number = 8
let g:startify_fortune_use_unicode = 1
let g:startify_session_autoload = 0
let g:startify_session_persistence = 1
let g:startify_update_oldfiles = 0
let g:startify_use_env = 1
let g:startify_session_before_save = [
\ 'silent! NERDTreeClose',
\ 'silent! UndotreeHide',
\ 'silent! TagbarClose'
\ ]
"
" Autoformat
"
let g:formatdef_js_editorconfig = '"js-beautify --editorconfig"'
let g:formatdef_json_editorconfig = '"js-beautify --editorconfig"'
let g:formatters_javascript = ['js_editorconfig']
let g:formatters_json = ['json_editorconfig']
let g:formatdef_html_editorconfig = '"html-beautify --editorconfig"'
let g:formatters_html = ['html_editorconfig']
"
" JsDoc
"
let g:jsdoc_enable_es6 = 1
"
" vim-json
"
let g:vim_json_syntax_conceal = 0
"
" devicons
"
let g:webdevicons_enable_denite = 0
let g:WebDevIconsNerdTreeAfterGlyphPadding = ''
let g:webdevicons_conceal_nerdtree_brackets = 1
let g:WebDevIconsNerdTreeGitPluginForceVAlign = 1
"
" tsuquyomi
"
let g:tsuquyomi_completion_detail = 1
let g:tsuquyomi_single_quote_import = 1
" let g:tsuquyomi_shortest_import_path = 1
let g:tsuquyomi_search_term_min_length = 3
"
" Ack & Ag
"
if executable('ag')
let g:ackprg = 'ag --vimgrep --smart-case'
el
echoerr "ag Silver Searcher was not found, check if it is installed!"
en
let g:ackhighlight = 0
"
" UltiSnips
"
if has("unix")
let g:UltiSnipsSnippetDirectories = [$HOME . '/.vim/UltiSnips', 'UltiSnips']
el
let g:UltiSnipsSnippetDirectories = [$HOME . '/vimfiles/UltiSnips', 'UltiSnips']
en
"let g:UltiSnipsUsePythonVersion = 2
let g:UltiSnipsExpandTrigger="<c-j>"
let g:UltiSnipsJumpForwardTrigger="<c-k>"
let g:UltiSnipsJumpBackwardTrigger="<c-l>"
"
" Projectionist
"
let g:projectionist_heuristics = {
\ "*": {
\ "src/*.cpp": {
\ "alternate": ["include/{}.hpp","test/src/{}Test.cpp"],
\ "type": "source"
\ },
\ "include/*.hpp": {
\ "alternate": ["test/src/{}Test.cpp","src/{}.cpp"],
\ "type": "header"
\ },
\ "test/src/*Test.cpp": {
\ "alternate": ["src/{}.cpp","include/{}.hpp"],
\ "type": "test"
\ },
\ "plugin/*.vim": {
\ "alternate": ["autoload/{}.vim","test/{}.vader","doc/{}.txt"],
\ "type": "plugin"
\ },
\ "autoload/*.vim": {
\ "alternate": ["test/{}.vader","doc/{}.txt","plugin/{}.vim"],
\ "type": "autoload"
\ },
\ "test/*.vader": {
\ "alternate": ["doc/{}.txt","autoload/{}.vim","plugin/{}.vim"],
\ "type": "test"
\ },
\ "doc/*.txt": {
\ "alternate": ["plugin/{}.vim","autoload/{}.vim","test/{}.vader"],
\ "type": "doc"
\ },
\ "*.play": {
\ "alternate": ["{}.gsv"],
\ "type": "play"
\ },
\ "*.gsv": {
\ "alternate": ["{}.play"],
\ "type": "ghost"
\ },
\ "src/app/*.ts": {
\ "alternate": ["src/app/{}.spec.ts"],
\ "type": "ts"
\ },
\ "src/app/*.spec.ts": {
\ "alternate": ["src/app/{}.ts"],
\ "type": "spec"
\ },
\ "src/app/*.scss": {
\ "alternate": ["src/app/{}.html"],
\ "type": "sass"
\ },
\ "src/app/*.css": {
\ "alternate": ["src/app/{}.html"],
\ "type": "css"
\ },
\ "src/app/*.html": {
\ "alternate": ["src/app/{}.scss","src/app/{}.css"],
\ "type": "html"
\ },
\ "src/*/environment.ts": {
\ "alternate": ["src/{}/environment.prod.ts"],
\ "type": "config"
\ },
\ }
\}
"
" Tagbar
"
let g:tagbar_autofocus=0
let g:tagbar_compact=1
let g:tagbar_right = 1
let g:tagbar_width = 35
let g:tagbar_type_typescript = {
\ 'ctagsbin' : 'tstags',
\ 'ctagsargs' : '-f-',
\ 'kinds': [
\ 'e:enums:0:1',
\ 'f:function:0:1',
\ 't:typealias:0:1',
\ 'M:Module:0:1',
\ 'I:import:0:1',
\ 'i:interface:0:1',
\ 'C:class:0:1',
\ 'm:method:0:1',
\ 'p:property:0:1',
\ 'v:variable:0:1',
\ 'c:const:0:1',
\ ],
\ 'sort' : 0
\ }
"
" NERDCommenter
"
" Align line-wise comment delimiters
" flush left instead of following code indentation
let g:NERDDefaultAlign = 'left'
" Add speces after comment delimiters by default
let g:NERDSpaceDelims = 1
"
" NERDTree
"
let g:NERDTreeAutoDeleteBuffer = 1
let g:NERDTreeWinPos = "left"
let g:NERDTreeWinSize = 35
let g:NERDTreeIgnore = [
\ '\.job$',
\ '^CVS$',
\ '\.orig',
\ '\~$',
\ '\.res$',
\ '\.rex$',
\ '\.log$',
\ '\.patch$',
\ '\.playconf$',
\ '\.tags$',
\ 'cscope\.out$'
\ ]
let g:NERDTreeStatusline = "%f"
" source: https://github.com/scrooloose/nerdtree/issues/636
let g:NERDTreeDirArrowExpandable = " "
let g:NERDTreeDirArrowCollapsible = " "
"
" NERDTree File highlighting
"
let g:NERDTreeFileExtensionHighlightFullName = 1
let g:NERDTreeExactMatchHighlightFullName = 1
let g:NERDTreePatternMatchHighlightFullName = 1
" enables folder icon highlighting using exact match
let g:NERDTreeHighlightFolders = 1
" highlights the folder name
let g:NERDTreeHighlightFoldersFullName = 1
let s:brown = "905532"
let s:aqua = "3AFFDB"
let s:blue = "689FB6"
let s:darkBlue = "44788E"
let s:purple = "834F79"
let s:lightPurple = "834F79"
let s:red = "AE403F"
let s:beige = "F5C06F"
let s:yellow = "F09F17"
let s:orange = "D4843E"
let s:darkOrange = "F16529"
let s:pink = "CB6F6F"
let s:salmon = "EE6E73"
let s:green = "8FAA54"
let s:lightGreen = "31B53E"
let s:white = "FFFFFF"
let s:rspec_red = 'FE405F'
let s:git_orange = 'F54D27'
let g:NERDTreePatternMatchHighlightColor = {} " this line is needed to avoid error"
let g:NERDTreePatternMatchHighlightColor['src\/'] = s:blue
let g:NERDTreePatternMatchHighlightColor['include\/'] = s:green
let g:NERDTreePatternMatchHighlightColor['test\/'] = s:salmon
let g:NERDTreePatternMatchHighlightColor['demo\/'] = s:beige
let g:NERDTreePatternMatchHighlightColor['obj\/'] = s:lightPurple
let g:NERDTreePatternMatchHighlightColor['lib\/'] = s:lightPurple
let g:NERDTreePatternMatchHighlightColor['bin\/'] = s:lightPurple
let g:NERDTreePatternMatchHighlightColor['links\/'] = s:lightPurple
let g:NERDTreePatternMatchHighlightColor['logs\/'] = s:lightPurple
let g:NERDTreePatternMatchHighlightColor['etc\/'] = s:green
let g:NERDTreePatternMatchHighlightColor['data\/'] = s:green
let g:NERDTreePatternMatchHighlightColor['bower_components\/'] = s:lightPurple
let g:NERDTreePatternMatchHighlightColor['node_modules\/'] = s:lightPurple
"
" YouCompleteMe
"
if has("unix") && has("python")
let g:ycm_global_ycm_extra_conf = '~/.vim/.ycm_extra_conf.py'
let g:ycm_max_diagnostics_to_display = 1000
let g:ycm_min_num_of_chars_for_completion = 0
let g:ycm_min_num_identifier_candidate_chars = 0
let g:ycm_collect_identifiers_from_tags_files = 1
let g:ycm_auto_trigger = 1
let g:ycm_register_as_syntastic_checker = 0
let g:ycm_use_ultisnips_completer = 0
let g:ycm_filetype_blacklist = {
\ 'vim' : 1,
\ 'tagbar' : 1,
\ 'qf' : 1,
\ 'notes' : 1,
\ 'markdown' : 1,
\ 'md' : 1,
\ 'unite' : 1,
\ 'text' : 1,
\ 'vimwiki' : 1,
\ 'pandoc' : 1,
\ 'infolog' : 1,
\ 'tts' : 1,
\ 'edi' : 1,
\ 'valgrind' : 1,
\ 'mail' : 1
\}
nn <Leader>12 :YcmForceCompileAndDiagnostics<CR>
nn <C-LeftMouse> :YcmCompleter GoTo<CR>
en
"
" Airline
"
let g:airline_powerline_fonts = 1
let g:Powerline_symbols = 'fancy'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#fnamemod = ':t'
" This is handled by lessmess
let g:airline#extensions#whitespace#enabled = 0
let g:airline_theme = 'solarized'
let g:airline_section_z = airline#section#create([
\ 'windowswap',
\ '%3p%% ',
\ 'linenr',
\ ':%3v'])
let g:airline_highlighting_cache = 1
"
" CtrlP
"
" Index all files
let g:ctrlp_max_files = 0
let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' }
" Enable CtrlP caching
let g:ctrlp_use_caching = 1
" Set the directory to store the cache files
let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp'
" Enable cross-session caching by not deleting the cache files upon exiting
" Scan dotfiles and dotdirs
let g:ctrlp_show_hidden = 0
let g:ctrlp_clear_cache_on_exit = 0
if executable('ag')
" Make CtrlP even faster using the silver search
let g:ctrlp_user_command = 'ag -l --nocolor -g "" %s'
let g:ctrlp_clear_cache_on_exit = 1
elsei executable('ack')
let g:ctrlp_user_command = 'ack -k --nocolor -g "" %s'
en
" Make CtrlP open files in new buffer
let g:ctrlp_switch_buffer = 0
" Make CtrlP follow CWD
let g:ctrlp_working_path_mode = 0
" Enable searching by filename instead of full path
let g:ctrlp_by_filename = 1
let g:ctrlp_custom_ignore = {
\ 'file': '\v\.(res|rex|log|playconf|gsvconf)$',
\ 'dir': '\v[\/]\.(git|hg|svn|node_modules|bower_components|coverage|doc|dist)$'
\ }
" HACK: Legacy hack to avoid opening files in NERDTree split
let g:ctrlp_dont_split = 'NERD'
let g:ctrlp_dont_split = 'nerdtree'
let g:ctrlp_dont_split = 'NERD_tree_2'
let g:ctrlp_cmd = 'cal CtrlPCustomCommand()'
"
" GitGutter
"
let g:gitgutter_max_signs=9999
"
" ALE
"
" let g:ale_fix_on_save = 1
let g:ale_fixers = {
\ 'html': ['eslint'],
\ 'javascript': ['jshint'],
\ 'json': ['jsonlint'],
\ 'markdown': ['mdl'],
\ 'scss': ['prettier'],
\ 'typescript': ['tslint','prettier'],
\}
"
" Syntastic
"
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 0
" tell syntastic not to open quickfix or loclist.
let g:tsuquyomi_disable_quickfix = 1
" Leave this one commented out if you don't want loc list to be opened
let g:syntastic_auto_loc_list = 1
let g:syntastic_aggregate_errors = 1
" Use sign column to mark errors
" let g:syntastic_enable_signs = 1
let g:syntastic_typescript_tslint_args = "--project ./"
let g:syntastic_typescript_checkers = ['tsuquyomi', 'tslint']
let g:syntastic_xml_checkers = ['xmllint']
let g:syntastic_json_checkers = ['jsonlint']
" let g:syntastic_javascript_checkers = ['jscs', 'jshint']
let g:syntastic_javascript_checkers = ['jshint']
let g:syntastic_html_checkers = ['eslint']
let g:syntastic_vimlint_checkers = ['vimlint']
let g:syntastic_markdown_checkers = ['mdl']
"
" Javascript
"
let g:javascript_plugin_jsdoc = 1
let g:javascript_plugin_flow = 1
" }}}
" Keymap {{{
"
"
"
" Precision marks
" back tick jumps to the exact location (line, col)
" whereas tick jumps to only to the line.
"
no ' `
no ` '
"
" Easy surround
"
vn ' di'<ESC>pa'<ESC>
" FIXME: This is conflicting with paste mode S-Insert
if !has("gui_running")
vn " di"<ESC>pa"<ESC>
en
vn ` di`<ESC>pa`<ESC>
vn [ di[<ESC>pa]<ESC>
vn ( di(<ESC>pa)<ESC>
vn { di{<ESC>pa}<ESC>
vn [( di[(<ESC>pa)]<ESC>
vn {{ di{{ <ESC>pa }}<ESC>
"
" Searches
"
" Keep search matches in the middle of the window and pulse the line when moving to them.
nn n nzzzv
nn N Nzzzv
" Easy find/replace
" Normal mode
" Prepares substitute command to replace word under cursor
" globally and with confirmation
nn <Leader>r :,$s/\<<C-R><C-w>\>//gc<Left><Left><Left>
nn <Leader>R :%s/\<<C-R><C-w>\>//gc<Left><Left><Left>
" Visual mode
" Prepares substitute command to replace selected chunck
" globally and with confirmation
vn <Leader>r y<Esc>:,$s/<C-R>"//gc<Left><Left><Left>
vn <Leader>R y<Esc>:,$s/<C-R>"//gc<Left><Left><Left>
"
" visual star search
vn * y/<C-R>"<CR>
"
" Easy help
nn <Leader>h :he <C-R><C-w><CR>
vn <Leader>h y<Esc>:he <C-R>"<CR>
"
" Files
"
" Edit .notes
nn <Leader>0 :e! $HOME/.notes/index.md<CR>
" Edit .vimrc
nn <silent> <Leader>v :e! $MYVIMRC<CR>
"
" lessmess
"
nn <silent> <Leader>l :LessmessDisplayToggle<CR>
"
" Smooth scroll
"
nn <silent> <c-u> :call smooth_scroll#up(&scroll, 0, 2)<CR>
nn <silent> <c-d> :call smooth_scroll#down(&scroll, 0, 2)<CR>
nn <silent> <c-b> :call smooth_scroll#up(&scroll*2, 0, 4)<CR>
nn <silent> <c-f> :call smooth_scroll#down(&scroll*2, 0, 4)<CR>
"
" Basic indentation fix
"
" Formats the entire file and returns to the line
" = can be used in visual mode to format the block
" to format current line == can be used
nn <silent> <Leader>i mzgg=G`z
"
" tsuquyomi Typescript Import
"
exe "se <M-l>=\el"
nn <M-l> :TsuImport<CR>
exe "se <M-s>=\es"
nn <M-s> :TsuSearch <C-R><C-w><CR>
"
" Async Job
"
nn <Leader>j :Jobdo<Space>
"
" Ack
"
nn <Leader>a :Ack!<Space>''<Left>
nn <Leader>A :AckWindow!<Space>''<Left>
nn <silent> <Leader>n :AckFromSearch!<CR>
"
" View Tasks
"
" In file
nn <silent> <Leader>t /\vFIXME\|TODO\|HACK<CR>
" In cwd
nn <silent> <Leader>T :Ack!<Space>"FIXME\|TODO\|HACK"<CR>
"
" Spell Checking
"
nn <silent> <Leader>7 :se spell!<CR>
"
" Wrapping Shortcuts
"
vm Q gq
nm Q gqap
"
" Buffers & Window Navigation
"
nn <silent> <Tab> :bnext<CR>
nn <silent> <S-Tab> :bprevious<CR>
"
" Closing buffer without a lot of mess
"
" Get rid of function key bindings
nn <silent> <C-w>w :bp<bar>sp<bar>bn<bar>bd<CR>
" This load buffer before closing it and causes vim to hang
" nn <silent> <C-w>a :bufdo bp<bar>sp<bar>bn<bar>bd<CR>
" Keep current buffer only
nn <silent> <C-w>a :bd<bar>BufOnly<CR>
"
" Enable scroll bind
"
nm <silent> <Leader>scb :se scb!<CR>
"
" Vimdiff
"
if &diff
" next difference
nn dj ]c
" previous difference
nn dk [c
en
"
" File utilities
"
" Print file path
nm <silent> <Leader>ef :!echo %<CR>
" Echo file
nm <silent> <Leader>cf :!cat %<CR>
"
" Remap number increment and decrement
" to avoid conflicts with gnu screen on linux
"
" I use Alt+a Alt+x because it is convenient to hold Alt while inc/dec multiple times.
if has("unix")
exe "se <M-a>=\ea"
nn <M-a> <C-A>
no <C-a> <NOP>
exe "se <M-x>=\ex"
nn <M-x> <C-X>
no <C-x> <NOP>
en
"
" Autoformat
"
exe "se <M-i>=\ei"
nn <M-i> :Autoformat<CR>