-
Notifications
You must be signed in to change notification settings - Fork 1
/
vimrc
905 lines (636 loc) · 21.1 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
"""""""""
" Plugins {{{
"""""""""
" Necessary for lots of cool vim things
set nocompatible
" Call vundle (must be before any Plugin)
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" UI Components {{{
"""""""""""""
" File explorer (,e)
Plugin 'scrooloose/nerdtree'
" Make NERDTree more awesome
Plugin 'jistr/vim-nerdtree-tabs'
" Show undo tree (,u)
Plugin 'sjl/gundo.vim'
" Show tags list (vars, funcs, etc) (,t)
Plugin 'majutsushi/tagbar'
" Fuzzy file finder (,o)
Plugin 'ctrlpvim/ctrlp.vim'
" Fuzzy function/method finder (,m)
Plugin 'tacahiroy/ctrlp-funky'
" Vim recipe finder (,r)
Plugin 'esneider/vim-recipes'
" }}}
" Editor commands {{{
"""""""""""""""
" Add surround modifier to vim (s noun)
Plugin 'tpope/vim-surround'
" Change case (crs: snake_case, crm: MixedCase, crc: camelCase, cru: UPPER_CASE)
Plugin 'tpope/vim-abolish'
" Add function arguments text objects (a noun)
" FIXME: hangs vim
" Plugin 'vim-scripts/argtextobj.vim'
" Toggle comments (,/)
Plugin 'tomtom/tcomment_vim'
" Select regions in visual mode (+ and _)
Plugin 'terryma/vim-expand-region'
" Multiple cursors (next: Ctrl-N, prev: Ctrl-P, skip: Ctrl-X)
Plugin 'terryma/vim-multiple-cursors'
" Window resizing (,w)
Plugin 'jimsei/winresizer'
" Location and quickfix window toggle (,l and ,q)
Plugin 'milkypostman/vim-togglelist'
" Cycle through the clipboard history after pasting (]p and [p)
Plugin 'maxbrunsfeld/vim-yankstack'
" }}}
" Editor enhancements {{{
"""""""""""""""""""
" Support repeating surround actions
Plugin 'tpope/vim-repeat'
" Automatic completion (select with tab)
Plugin 'Valloric/YouCompleteMe'
" YCM config file generator
Plugin 'rdnetto/YCM-Generator'
" Show N out of M in searches
Plugin 'henrik/vim-indexed-search'
" Incrementally highlight all pattern matches (/ and ?)
Plugin 'haya14busa/incsearch.vim'
" Incrementally highlight all pattern matches (:s)
Plugin 'osyo-manga/vim-over'
" Smart automatic removal of trailing whitespaces
Plugin 'esneider/vim-trailing'
" Make f/F behave like ;/, after an f motion (same for F, t and T)
Plugin 'rhysd/clever-f.vim'
" Manage plugins (github repos)
Plugin 'gmarik/vundle'
" }}}
" External tools {{{
""""""""""""""
" Syntax checker (,c)
Plugin 'scrooloose/syntastic'
" Ack search (,f and ,F)
Plugin 'mileszs/ack.vim'
" Git utils (,g + [c]ommit [d]iff git[h]ub [l]og [m]ove [p]ush [r]emove [s]tatus)
Plugin 'tpope/vim-fugitive'
" Show repo diff signs (,d)
Plugin 'mhinz/vim-signify'
" Show documentation (mac only) (,k)
Plugin 'rizzatti/dash.vim'
" Warn after 20 writes without commiting
Plugin 'esneider/YUNOcommit.vim'
" }}}
" Language specific {{{
"""""""""""""""""
" Switch between source and header file (,h)
Plugin 'derekwyatt/vim-fswitch'
" HTML5 syntax
Plugin 'othree/html5.vim'
" Better indentation and highlighting for JavaScript
Plugin 'pangloss/vim-javascript'
" Automatic completion for JavaScript
Plugin 'marijnh/tern_for_vim'
" Latex compilation (,x)
Plugin 'TeX-PDF'
" Markdown compilation
Plugin 'suan/vim-instant-markdown'
" Rust syntax
Plugin 'rust-lang/rust.vim'
" Docker syntax
Plugin 'ekalinin/Dockerfile.vim'
" Terraform syntax
Plugin 'hashivim/vim-terraform'
" }}}
" Look and feel {{{
"""""""""""""
" Pretty status bar
Plugin 'bling/vim-airline'
" Airline themes
Plugin 'vim-airline/vim-airline-themes'
" Lots of colorschemes
Plugin 'flazz/vim-colorschemes'
" Function and namespace highlighting
Plugin 'esneider/vim-simlight'
" TESTING
Plugin 'zeayes/vim-coloresque'
" Clean interface
Plugin 'junegunn/goyo.vim'
" }}}
" Call yankstack (must be before any mapping using y or p)
let g:yankstack_map_keys = 0
silent! call yankstack#setup()
" }}}
"""""""""""""""
" Auto commands {{{
"""""""""""""""
" Group all autocmds
augroup vimrc
autocmd!
" Highlight first word after column 80
autocmd BufWinEnter * let w:m2 = matchadd('CursorLine', '\%81v\s*\zs\S\+', -1)
" Restore cursor position to where it was before closing
autocmd BufReadPost * silent! execute 'normal! g`"'
" Check for file changes after 'updatetime' milliseconds of cursor hold
autocmd CursorHold * silent! checktime
" Automatically cd into the current file's directory
autocmd BufEnter * silent! cd %:p:h
" Show search index
autocmd User IncSearchLeave ShowSearchIndex
" Hide cursor line when focus is lost, and in insert mode
autocmd WinLeave,InsertEnter * set nocursorline
autocmd WinEnter,InsertLeave * set cursorline
" }}}
"""""""""""""""""""
" Filetype commands {{{
"""""""""""""""""""
" Ruby filetype detection
autocmd BufRead,BufNewFile Gemfile,Capfile,config.ru,Vagrantfile setfiletype ruby
" Markdown filetype detection
autocmd BufRead,BufNewFile *.md setfiletype markdown
" Use NASM as the default assembly syntax
autocmd BufRead,BufNewFile *.asm setfiletype nasm
" Gradle filetype detection
autocmd BufRead,BufNewFile *.gradle setfiletype groovy
" Use 2 spaces for indentation in ruby, and allow ! and ? in keywords
autocmd FileType ruby setlocal tabstop=2 softtabstop=2 shiftwidth=2 iskeyword+=!,?
" Use tabs in makefiles
autocmd FileType make setlocal noexpandtab
" Enable spell checking in commit, markdown and text files
autocmd FileType gitcommit,svn,asciidoc,markdown setlocal spell
" Use vim help for K in vimscript
autocmd FileType vim setlocal keywordprg=:help
" Disable automatic label dedenting
autocmd FileType cpp setlocal cinoptions+=L0
" Allow - and . in keywords
autocmd FileType css setlocal iskeyword+=-,.
" All autocmds should be before this
augroup END
" }}}
""""""""""""""""
" General config {{{
""""""""""""""""
" Enable file type specific behaviour
filetype plugin indent on
" Use utf8
set encoding=utf-8
" Automatically read a file when it is changed from the outside
set autoread
" Don't redraw while executing macros
set lazyredraw
" Entries of the commands history
set history=1000
" Entries of the undo list
set undolevels=1000
" Prevent some security exploits
set modelines=0
" Disable fucking bell
set vb t_vb=
" Fold text when markers {{{ and }}} are found
set foldmethod=marker
" Update after 1 second of no activity (check for external file change, etc.)
set updatetime=1000
" Don't bother with swap files
set noswapfile
" Keep a persistent undo backup file
if has('persistent_undo')
set undofile undodir=~/.vim/undo//,~/tmp//,/tmp//
endif
" Ctags index directories
set tags=.git/tags;$HOME,.svn/tags;$HOME,tags;$HOME
" Ignore whitespace in diff mode
set diffopt+=iwhite
" }}}
""""""""""""""""""""""""""""
" Complete and search config {{{
""""""""""""""""""""""""""""
" Command line completion stuff
set wildmenu
set wildmode=list:longest,full
set wildignore=.svn,.git,*.o,*~,*.swp,*.pyc,*.class,*.dSYM
" Tab completion stuff
set completeopt=longest,menuone
" Ignore case when searching
set ignorecase
" Unless upper case is used
set smartcase
" Use incremental searching (search while typing)
set incsearch
" Highlight things that we find with the search
set hlsearch
" Search/replace globally (on a line) by default
set gdefault
" Set flags for grep command
set grepprg=grep\ -nH\ $*\ /dev/null
" Syntax completion by highlight rules for unsupported filetypes
set omnifunc=syntaxcomplete#Complete
" }}}
""""""""""""""
" Input config {{{
""""""""""""""
" Enable auto indenting on new lines (and be smart on newlines)
set autoindent cindent copyindent
" Use spaces instead of tabs (and be smart on newlines)
set expandtab smarttab
" Tab equals 4 spaces
set shiftwidth=4 softtabstop=4 tabstop=4
" Make backspace work like it should
set backspace=2
" Enable mouse support in console
set mouse=a
" Don't reset cursor to start of line when moving around
set nostartofline
" Shift plus movement keys changes selection
set keymodel=startsel,stopsel
" Allow cursor keys to go right off end of one line, onto start of next
set whichwrap+=<,>,[,],h,l
" When at 3 spaces, and hit > ... go to 4, not 7
set shiftround
" Allow the cursor one beyond last character and everywhere in V-block mode
set virtualedit=onemore,block
" Faster commands
set ttimeout ttimeoutlen=50
" Don't resize all remaining splits when opening/closing a split
set noequalalways
" Put new vertical splits to the right/below of the current one
set splitright splitbelow
" Display as much as possible of a window's last line
set display+=lastline
" Use only one space after '.' when joining lines, instead of two
set nojoinspaces
" Set automatic formatting settings
set formatoptions=tcroqn
" Handle comments when joining lines
if v:version > 703 || (v:version == 703 && has('patch541'))
set formatoptions+=j
endif
" Use system clipboard as default register
set clipboard=unnamed,unnamedplus
" Instead of failing after a missing !, ask what to do
set confirm
" Ctrl-{A,X} work on dec, hex, and chars (not octal)
set nrformats=alpha,hex
" }}}
""""""""""""""""
" Display config {{{
""""""""""""""""
" Enable syntax highlighting
syntax enable
" Show line numbers
set number
" Show status line
set laststatus=2
" Show incomplete commands while you are typing them
set showcmd
" Have 5 lines ahead of the cursor in screen whenever possible
set scrolloff=5
" Try to change the terminal title
set icon title
" Indent wrapped lines correctly
if v:version > 704 || (v:version == 704 && has('patch338'))
set breakindent
endif
" Highlight the line that the cursor is on
set cursorline
" Force 256 colors in terminal
set t_Co=256
" Disable everything in gvim
set guioptions=
" Set font in MacVim
if has('gui_macvim')
set guifont=Menlo:h14
end
" Use a dark background
set background=dark
" Don't try to highlight lines longer than 500 characters
set synmaxcol=500
" Enable text concealment (mainly for latex)
set conceallevel=2
" }}}
""""""""""""""
" Highlighting {{{
""""""""""""""
" Set color scheme
silent! colorscheme kellys
" Highlight functions and namespaces (simlight plugin)
highlight Function guifg=#afdfdf ctermfg=152
highlight Namespace guifg=#a8a8a8 ctermfg=248
" Color notifications
highlight NotifyGreen gui=bold guifg=#8dfa81 cterm=bold ctermfg=119
highlight NotifyRed gui=bold guifg=#e47574 cterm=bold ctermfg=167
highlight NotifyYellow gui=bold guifg=#fffb87 cterm=bold ctermfg=227
" Hide tildes (~) in place of line numbers after EOF
silent! highlight NonText guifg=bg guibg=bg
silent! highlight NonText ctermfg=bg ctermbg=bg
" Highlight gutter diff signs (signify plugin)
highlight link SignifySignAdd NotifyGreen
highlight link SignifySignDelete NotifyRed
highlight link SignifySignChange NotifyYellow
" Highlight gutter compilation errors (syntastic plugin)
highlight link SyntasticErrorSign NotifyRed
highlight link SyntasticWarningSign NotifyYellow
highlight link SyntasticStyleErrorSign NotifyRed
highlight link SyntasticStyleWarningSign NotifyYellow
" Highlight merge conflict markers
match Todo '\v^(\<|\=|\>){7}([^=].+)?$'
" }}}
""""""""""""""
" Key mappings {{{
""""""""""""""
" Map backspace key to dismiss search highlighting
nnoremap <silent> <BS> :nohlsearch<CR>
" Map tab key to jump to matching entity: (), [], {}, etc
nmap <silent> <Tab> %
vmap <silent> <Tab> %
" Disable Ex mode and use Q for formatting the current paragraph (or selection)
vnoremap <silent> Q gq
nnoremap <silent> Q gqap
" Up and down are more logical with g
nnoremap <silent> k gk
nnoremap <silent> j gj
inoremap <silent> <Up> <C-\><C-o>gk
inoremap <silent> <Down> <C-\><C-o>gj
" Toggle folds with space
nnoremap <silent> <Space> za
" Remap jj to escape in insert mode
inoremap jj <Esc>
" Usual Home and End shortcuts
inoremap <C-A> <Home>
inoremap <C-E> <End>
" Make Y consistent with C and D
nnoremap <silent> Y y$
" Repeat the last substitution, using the same flags
nnoremap <silent> & :&&<CR>
xnoremap <silent> & :&&<CR>
" Remain in visual mode after '<' or '>'
vnoremap <silent> < <gv
vnoremap <silent> > >gv
" Don't yank when pasting in visual mode
vnoremap <silent> p "_dP
vnoremap <silent> P "_dP
" Make * and # work with visual selection
vnoremap <silent> * yq/i\V<Esc>p<CR>
vnoremap <silent> # yq?i\V<Esc>p<CR>
" Repeat last action for each line in the visual selection
vnoremap <silent> . :normal .<CR>
" Select last paste in visual mode
nnoremap <expr> gb '`[' . strpart(getregtype(), 0, 1) . '`]'
" Open new tab with ctrl-t
nnoremap <silent> <C-t> :tabnew<CR>
inoremap <silent> <C-t> <C-\><C-o>:tabnew<CR>
" Move to next/previous tab with right/left arrows
nnoremap <silent> <Left> :tabprevious<CR>
nnoremap <silent> <Right> :tabnext<CR>
" Move to tag definition and back with down/up arrows
nnoremap <silent> <Up> <C-t>
nnoremap <silent> <Down> g<C-]>
" Move through splits with Ctrl-{hjkl}
nnoremap <silent> <C-h> :wincmd h<CR>
inoremap <silent> <C-h> <Esc>:wincmd h<CR>
nnoremap <silent> <C-j> :wincmd j<CR>
inoremap <silent> <C-j> <Esc>:wincmd j<CR>
nnoremap <silent> <C-k> :wincmd k<CR>
inoremap <silent> <C-k> <Esc>:wincmd k<CR>
nnoremap <silent> <C-l> :wincmd l<CR>
inoremap <silent> <C-l> <Esc>:wincmd l<CR>
" Make ' jump to saved line & column rather than just line
nnoremap ' `
nnoremap ` '
" Disable the MiddleMouse button
nnoremap <MiddleMouse> <Nop>
inoremap <MiddleMouse> <Nop>
" Move selection one line down/up
vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv
" Use S to split a line
nnoremap S i<CR><Esc>
" Plugin IncSearch redirects
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map n <Plug>(incsearch-nohl-n)zvzz
map N <Plug>(incsearch-nohl-N)zvzz
map * <Plug>(incsearch-nohl-*)zv
map # <Plug>(incsearch-nohl-#)zv
" Make : easier to type
nnoremap ; :
nnoremap : ;
vnoremap ; :
vnoremap : ;
" TESTING: move automatically inside delimiters after typing them
inoremap '' ''<Left>
inoremap "" ""<Left>
inoremap () ()<Left>
inoremap <> <><Left>
inoremap {} {}<Left>
inoremap [] []<Left>
inoremap () ()<Left>
" }}}
""""""""""""""""""""""
" Directional mappings {{{
""""""""""""""""""""""
" Jump to next/previous merge conflict marker
nnoremap <silent> ]c /\v^(\<\|\=\|\>){7}([^=].+)?$<CR>
nnoremap <silent> [c ?\v^(\<\|\=\|\>){7}([^=].+)\?$<CR>
" Jump to next/previous diff marker (signify plugin)
nmap <silent> ]d <Plug>(signify-next-hunk)
nmap <silent> [d <Plug>(signify-prev-hunk)
" Move to next/previous location list entry (error)
nnoremap <silent> ]e :lnext<CR>
nnoremap <silent> [e :lprevious<CR>
" Switch to next/previous colorscheme
nnoremap <silent> ]k :call Kolors(+1)<CR>
nnoremap <silent> [k :call Kolors(-1)<CR>
" Move to next/previous method with ]m and [m
" After pasting, cycle forwards/backwards through the clipboard history
nmap <silent> ]p <Plug>yankstack_substitute_newer_paste
nmap <silent> [p <Plug>yankstack_substitute_older_paste
" Move to next/previous spelling error with ]s and [s
" Switch to next/previous tab
nnoremap <silent> ]t :tabnext<CR>
nnoremap <silent> [t :tabprevious<CR>
" }}}
""""""""""""""""""
" Command mappings {{{
""""""""""""""""""
" Some typo corrections
command! -bang WQ wq<bang>
command! -bang Wq wq<bang>
command! -bang W w<bang>
command! -bang Q q<bang>
" Save file with sudo
cnoreabbrev w!! w !sudo tee % > /dev/null
" Ctrl-A to go to the start of line
cnoremap <C-A> <Home>
" }}}
"""""""""""""""""
" Leader mappings {{{
"""""""""""""""""
" Change mapleader
let mapleader=','
" Open a split on the given side
nnoremap <silent> <Leader><Up> :leftabove split<CR>
nnoremap <silent> <Leader><Left> :leftabove vsplit<CR>
nnoremap <silent> <Leader><Down> :rightbelow split<CR>
nnoremap <silent> <Leader><Right> :rightbelow vsplit<CR>
" Open last file
nnoremap <silent> <Leader><Leader> <C-^>
" Toggle comments of current line
nnoremap <silent> <Leader>/ :let w:tcommentPos=getpos('.')<CR>:set opfunc=tcomment#OperatorLine<CR>g@$
" Toggle comments of selection
vnoremap <silent> <Leader>/ :TCommentMaybeInline<CR>
" [C]heck syntax
nnoremap <silent> <Leader>c :w<CR>:SyntasticCheck<CR>
" [C]lear syntax error markers
nnoremap <silent> <Leader>C :SyntasticReset<CR>
" Toggle repo [d]iff signs
nnoremap <silent> <Leader>d :SignifyToggle<CR>
" Toggle the file [e]xplorer
nnoremap <silent> <Leader>e :NERDTreeTabsToggle<CR>
" [F]ind in files the word under the cursor
nnoremap <silent> <Leader>f :cd `git rev-parse --show-toplevel`<CR>:Ack!<Space>"<C-R><C-W>"<CR>
" [F]ind in files
nnoremap <Leader>F :cd `git rev-parse --show-toplevel`<CR>:Ack!<Space>""<Left>
" [G]it [b]lame
nnoremap <silent> <Leader>gb :Gblame!<CR>
" [G]it [c]ommit
nnoremap <silent> <Leader>gc :Git add -p<CR>:Gcommit -v<CR>
" [G]it [d]iff
nnoremap <silent> <Leader>gd :Git diff --color<CR>
" [G]it [d]iff staged files
nnoremap <silent> <Leader>gD :Git diff --color --cached<CR>
" Open file in [g]it[h]ub
nnoremap <silent> <Leader>gh :Gbrowse<CR>
" [G]it [l]og
nnoremap <silent> <Leader>gl :Git log --oneline --decorate --graph --color<CR>
" [G]it [l]og with diffs
nnoremap <silent> <Leader>gL :Git log --oneline --decorate --graph --color -p<CR>
" [G]it [m]ove
nnoremap <Leader>gm :Gmove<Space>
" [G]it [p]ush
nnoremap <silent> <Leader>gp :Git push<CR>
" [G]it [p]ull
nnoremap <silent> <Leader>gP :Git pull --rebase --prune<CR>
" [G]it [r]emove
nnoremap <silent> <Leader>gr :Gremove<CR>
" [G]it [s]tatus
nnoremap <silent> <Leader>gs :Gstatus<CR>
" [G]it c[t]ags
nnoremap <silent> <Leader>gt :Git ctags<CR>
" Switch between source and [h]eader file
nnoremap <silent> <Leader>h :FSHere<CR>
" [I]mmersive mode (distraction free)
nnoremap <silent> <Leader>i :Goyo<CR>
" Extend K with Dash.app
nmap <silent> <Leader>k <Plug>DashSearch
" <Leader>l Toggles the [l]ocation-list
" Open the CtrlP-Funky extension with the word under the cursor ([m]ethod)
nnoremap <silent> <Leader>m :CtrlPFunky <C-R><C-W><CR>
" [O]pen file
nnoremap <silent> <Leader>o :CtrlP<CR>
" [O]pen file after reloading file structure
nnoremap <silent> <Leader>O :CtrlPClearCache<CR>:CtrlP<CR>
" <Leader>q Toggles the [q]uickfix-list
" Open the [r]ecipe browser
nnoremap <silent> <Leader>r :CtrlPRecipes<CR>
" Toggle [s]pell checking
nnoremap <silent> <Leader>s :setlocal spell!<CR>
" Open the [T]agbar plugin
nnoremap <silent> <Leader>t :TagbarToggle<CR>
" Open the G[u]ndo plugin
nnoremap <silent> <Leader>u :GundoToggle<CR>
" Edit [v]imrc in a new tab
nnoremap <silent> <Leader>v :tabnew<CR>:edit $MYVIMRC<CR>
" <Leader>w Opens the [W]inResizer plugin
" Execute late[x] (TeX-PDF plugin)
nnoremap <silent> <Leader>x :BuildAndViewTexPdf<CR>:redraw!<CR>
" }}}
"""""""""""""""
" Plugin config {{{
"""""""""""""""
" NERDTree plugin configuration
let NERDTreeDirArrows = 1
let NERDTreeWinSize = 25
let NERDTreeIgnore = ['\.svn$', '\.git$', '\.o$', '\~$', '\.swp$', '\.pyc$', '\.class$', '\.dSYM$']
let g:NERDTreeMapCWD = 'cc'
" NERDTreeTabs plugin configuration
let g:nerdtree_tabs_open_on_gui_startup = 0
" Taglist plugin configuration
let g:tagbar_compact = 1
let g:tagbar_width = 30
let g:tagbar_usearrows = 1
let g:tagbar_sort = 0
" Gundo plugin configuration
let g:gundo_width = 30
let g:gundo_preview_height = 15
let g:gundo_right = 1
" Syntastic plugin configuration
let g:syntastic_loc_list_height = 5
let g:syntastic_error_symbol = '✗'
let g:syntastic_warning_symbol = '⚠'
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_mode_map = {'mode': 'passive'}
let g:syntastic_javascript_jshint_args = '--config .jshintrc'
" YouCompleteMe plugin configuration
let g:ycm_error_symbol = '✗'
let g:ycm_warning_symbol = '⚠'
let g:ycm_allow_changing_updatetime = 0
let g:ycm_complete_in_comments = 1
let g:ycm_collect_identifiers_from_comments_and_strings = 1
let g:ycm_key_detailed_diagnostics = ''
let g:ycm_key_list_select_completion = ['<Tab>']
let g:ycm_key_list_previous_completion = ['<S-Tab>']
" Airline plugin configuration
let g:airline_powerline_fonts = 1
let g:airline_theme = 'powerlineish'
" tComment plugin configuration
let g:tcommentMaps = 0
" CtrlP plugin configuration
let g:ctrlp_map = ''
let g:ctrlp_max_height = 15
let g:ctrlp_switch_buffer = 'et'
let g:ctrlp_clear_cache_on_exit = 0
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" Bash syntax configuration (don't include . in iskeyword)
let g:sh_noisk = 1
" Doxygen syntax configuration (javadoc highlighting for C, C++, C# files)
let g:load_doxygen_syntax = 1
let doxygen_javadoc_autobrief = 0
" Tex syntax configuration
let g:tex_flavor = 'latex'
let g:tex_conceal = 'adgm'
" TeX-PDF plugin configuration
let g:tex_pdf_map_keys = 0
" Ack plugin configuration
let g:ackprg = 'ag --nocolor --nogroup --column'
" Signify plugin configuration
let g:signify_update_on_bufenter = 0
let g:signify_disable_by_default = 1
let g:signify_vcs_list = ['git', 'svn']
let g:signify_sign_change = '~'
" WinResizer plugin configuration
let g:winresizer_start_key = '<Leader>w'
" IndexedSearch plugin configuration
let g:indexed_search_mappings = 0
" IncSearch plugin configuration
let g:incsearch#auto_nohlsearch = 1
let g:incsearch#magic = '\v'
" % matches complex opening/closing entities
runtime! macros/matchit.vim
" }}}
"""""""""""
" Functions {{{
"""""""""""
function! Kolors(num)
let opt = [
\ 'jellybeans', 'kellys', 'molokai', 'mustang', 'wombat256mod', 'xoria256'
\ ]
execute 'colorscheme ' . opt[(match(opt, g:colors_name) + a:num) % len(opt)]
silent! highlight NonText guifg=bg guibg=bg
silent! highlight NonText ctermfg=bg ctermbg=bg
silent! highlight CursorLine term=NONE cterm=NONE
if g:colors_name ==# 'kellys'
highlight Function guifg=#afdfdf ctermfg=152
highlight Namespace guifg=#a8a8a8 ctermfg=248
endif
endf
" }}}