-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
920 lines (783 loc) · 22.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
" Prerequire {{{1
" source $VIMRUNTIME/vimrc_example.vim
set nocompatible
" }}}1
let g:go_version_warning=0
" let g:Lf_ShortcutF = '<c-p>'
" TODO: remove useless plugins
" Bundles {{{1
call plug#begin('~/.vim/bundle')
" on github {{{2
" syntax
" Plug 'kchmck/vim-coffee-script'
" Plug 'jelera/vim-javascript-syntax'
" Plug 'marijnh/tern_for_vim'
" Plug 'isRuslan/vim-es6'
" Plug 'othree/yajs.vim'
" Plug 'othree/javascript-libraries-syntax.vim'
Plug 'pangloss/vim-javascript'
Plug 'leafgarland/typescript-vim'
Plug 'octol/vim-cpp-enhanced-highlight'
" not always used, uncomment if needed. {{{3
" Plug 'kosl90/qt-highlight-vim'
" Plug 'derekwyatt/vim-scala'
" Plug 'lambdatoast/elm.vim'
" Plug 'guns/vim-clojure-static'
" Plug 'toyamarinyon/vim-swift'
" Plug 'keith/swift.vim' " this is better so far
" Plug 'groenewege/vim-less'
" Plug 'peterhoeg/vim-qml'
Plug 'tkztmk/vim-vala'
" Plug 'rust-lang/rust.vim'
" }}}3
Plug 'posva/vim-vue'
" Plug 'klen/python-mode'
" maybe someone will be deleted
Plug 'vim-scripts/gtk-vim-syntax'
" Bundle 'vim-scripts/gtk-mode'
" language tools
Plug 'tpope/vim-speeddating'
Plug 'kien/rainbow_parentheses.vim'
Plug 'jceb/vim-hier'
" Plug 'scrooloose/syntastic'
" Plug 'w0rp/ale'
Plug 'neomake/neomake'
Plug 'sbdchd/neoformat'
Plug 'fatih/vim-go'
Plug 'mattn/emmet-vim'
" move to new python environment
" Plug 'kosl90/pyflakes-vim'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'tomtom/tcomment_vim'
" Plug 'xuhdev/SingleCompile'
" Plug 'skammer/vim-css-color'
" Plug 'Rip-Rip/clang_complete'
" TODO: haskell-vim-now {{{3
" Plug 'zenzike/vim-haskell-unicode'
" Plug 'Phlogistique/unicode-haskell'
" Plug 'Twinside/vim-syntax-haskell-cabal'
" Plug 'ujihisa/neco-ghc'
" Plug 'eagletmt/ghcmod-vim'
" Plug 'bitc/vim-hdevtools'
" Haskell
"Plug 'raichoo/haskell-vim'
" Plug 'enomsg/vim-haskellConcealPlus'
"Plug 'Twinside/vim-hoogle'
" }}}3
" textobj family {{{3
" Plug 'kana/vim-textobj-user'
" Plug 'kana/vim-textobj-indent'
" Plug 'kana/vim-textobj-syntax'
" Plug 'kana/vim-textobj-function', { 'for': ['c', 'cpp', 'vim', 'java'] }
" Plug 'sgur/vim-textobj-parameter'
" }}}3
Plug 'tpope/vim-projectionist'
" theme
Plug 'tomasr/molokai'
" Bars, panels, and files
Plug 'bling/vim-airline'
" tools
Plug 'editorconfig/editorconfig-vim'
Plug 'junegunn/vim-easy-align'
Plug 'scrooloose/nerdtree'
" Plug 'kien/ctrlp.vim'
Plug 'Lokaltog/vim-easymotion'
Plug 'rking/ag.vim'
" Plug 'mileszs/ack.vim'
" Plug 'AndrewRadev/splitjoin.vim'
Plug 'majutsushi/tagbar'
" Plug 'airblade/vim-gitgutter'
Plug 'mhinz/vim-signify'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-surround'
Plug 'vim-scripts/LargeFile'
" Plug 'Shougo/vimproc.vim'
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
" Plug 'jeaye/color_coded'
" Plug 'terryma/vim-multiple-cursors'
" Plug 'nathanaelkane/vim-indent-guides'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'Yggdroot/LeaderF'
" }}}2
" TODO: clean bundles {{{3
" Plug 'JessicaKMcIntosh/TagmaTasks'
" Plug 'jgdavey/tslime.vim'
Plug 'ervandew/supertab'
" Plug 'moll/vim-bbye'
" Plug 'vim-scripts/gitignore'
" Git
" Plug 'int3/vim-extradite'
" Text manipulation
" Plug 'vim-scripts/Align'
" Plug 'vim-scripts/Gundo'
" Plug 'tpope/vim-commentary'
" Plug 'godlygeek/tabular'
" Plug 'michaeljsmith/vim-indent-object'
" Allow pane movement to jump out of vim into tmux
" Plug 'christoomey/vim-tmux-navigator'
" }}}3
" on vim-scripts {{{2
" Plug 'DoxygenToolkit.vim'
" Plug 'DrawIt'
" Plug 'conque'
" }}}2
" slowly download plugins {{{2
" Plug 'szw/vim-ctrlspace'
"Plug 'Valloric/YouCompleteMe'
" }}}2
call plug#end()
" }}}1
if has("win64") || has("win32") || has("win16")
let g:os = "Windows"
else
let g:os = substitute(system('uname'), '\n', '', '')
endif
if g:os == 'Darwin'
let transparentBg = 0
" yy doesn't work as we expect, remap it, copy content to '+' register
noremap yy "+yy
else
let transparentBg = 1
endif
" TODO: clean useless functions
" Functions {{{1
func! ChangeUnimpariedMap() " {{{2
if &loadplugins == 1
" unmap [b
" unmap ]b
nmap [t :tabprevious<CR>
nmap ]t :tabnext<CR>
nmap [T :tabfirst<CR>
nmap ]T :tablast<CR>
endif
endfunc " }}}2
function! Cfamilyformat() " {{{2
let fullpath = expand("%:p")
if has("win32")
let docformat = '1'
else
let docformat = '2'
endif
if &ft == 'c' || &ft == 'cpp'
execute "!astyle -A3s4cCSLwYmMfUpHjk1nz".docformat." --options=none '".fullpath."'"
"exe "!astyle '".fullpath."'"
elseif &ft == 'java'
execute "!astyle --options=none --style=java -A3s4cCSLwYmMfUpHjk1nz".docformat." '".fullpath."'"
endif
execute "redraw!"
endfunction " }}}2
func! Insertdomain() " {{{2
if &ft != 'c' && &ft != 'cpp'
return
endif
if has('win32')
let newline='\r\n'
else
let newline='\r'
endif
let classname = input('input class name: ')
let cmd = "%s/\\<\\(\\~\\?\\(\\a\\|_\\)\\w*(.*)\\s*\\w*\\s*\\);/".classname."::\\1".newline."{".newline."}".newline."/g"
exec cmd
endfunc " }}}2
func! Fileencoding() " {{{2
if &fenc == ""
return ""
endif
let b=""
if exists("+bomb") && &bomb
let b = "+b"
endif
return "[".&fenc.b."]"
endfunc " }}}2
func! Statusline() " {{{2
return "%f %m%y%r".Fileencoding()."%q%w[%{&ff}]%=%l,%c%V%12P"
endfunc " }}}2
func! Emacs_ctrl_l() " {{{2
let pos = s:pos_marker()
call s:scroll(pos)
endfunc " }}}2
func! s:pos_marker() " {{{2
let win_line_nu = winheight(0)
let cur_line_nu = winline()
let half_lines = win_line_nu/2+1
if cur_line_nu == 1
" top
return 2
elseif cur_line_nu <= half_lines
" (top, middle]
return 1
else
" (middle, bottom]
return 0
endif
endfunc " }}}2
func! s:scroll(pos) " {{{2
if a:pos == 2
" from top to bottom
normal zb
elseif a:pos == 1
" from middle to top
normal zt
else
" from bottom to middle
normal zz
endif
endfunc " }}}2
func! AutoNewLine() " {{{2
let last_line = getline('$')
if last_line != ""
call append(line('$'), [''])
endif
endfunc " }}}2
func! OpenVimrc() " {{{2
" TODO: check whether $MYVIMRC exist from buffers
if getline(nextnonblank(1)) == ""
e $MYVIMRC
else
vsp $MYVIMRC
endif
endfunc " }}}2
func! TabMapAux(num) " {{{2
exec "map <leader>".a:num." ".a:num."gt"
endfunc " }}}2
func! TabMap() " {{{2
let i = 1
while i < 10
call TabMapAux(i)
let i += 1
endwhile
endfunc " }}}2
func! MyTabLine() " {{{2
let s = ''
let t = tabpagenr()
let i = 1
while i <= tabpagenr('$')
let buflist = tabpagebuflist(i)
let winnr = tabpagewinnr(i)
let s .= '%' . i . 'T'
let s .= (i == t ? '%#TabLineSel#' : '%#TabLine#')
let bufnr = buflist[winnr - 1]
let file = bufname(bufnr)
let buftype = getbufvar(bufnr, 'buftype')
if buftype == 'nofile'
if file =~ '\/.'
let file = substitute(file, '.*\/\ze.', '', '')
endif
else
let file = fnamemodify(file, ':p:t')
endif
if file == ''
let file = '[No Name]'
endif
let s .= string(i) . ":"
let file = strpart(file, 0, 10)
let s .= file
let i = i + 1
endwhile
let s .= '%T%#TabLineFill#%='
let s .= (tabpagenr('$') > 1 ? '%999XX' : 'X')
return s
endfunction "}}}2
func! Preserve(command) " {{{2
let previous_search = @/
let previous_cursor_line = line('.')
let previous_cursor_column = col('.')
execute a:command
let @/ = previous_search
call cursor(previous_cursor_line, previous_cursor_column)
endfunc " }}}2
func! DeleteTrailingBlank() " {{{2
call Preserve("%s/\\s\\+$//e")
endfunc " }}}2
func! Find(args) " {{{2
let g = ""
let j = ""
let files = "%"
let pat = ""
let args = split(a:args)
if empty(a:args)
let pat = expand("<cword>")
elseif len(args) == 1
let pat = args[0]
elseif len(args) == 2
if args[0] == '-g'
let g = 'g'
let pat = args[1]
elseif args[0] == '-j'
let j = 'j'
let pat = args[1]
elseif args[0] == '-gj' || args[0] == '-jg'
let g = 'g'
let j = 'j'
let pat = args[1]
else
let pat = args[0]
let files = args[1]
endif
elseif len(args) >= 3
if args[0] == '-j'
let j = 'j'
elseif args[0] == '-g'
let g = 'g'
elseif args[0] == '-gj' || args[0] == '-jg'
let j = 'j'
let g = 'g'
endif
let pat = args[1]
let files = join(args[2:], ' ')
endif
exec 'vimgrep /'.pat.'/'.g.j.' '.files
endfunction " }}}2
func! ReadTemplate() " {{{2
let _file_type = &ft
if filereadable('%')
return
end
let template_file = {
\ "html": "~/.vim/template/html.html",
\ "python": "~/.vim/template/python.py",
\ "ruby": "~/.vim/template/ruby.rb",
\ }
let path = get(template_file, &ft, "")
if path != ""
silent exec "0read ".path
end
endfunction " }}}2
func! s:goComplete(ArgLead, CmdLine, CursorPos) "{{{2
let s:goos = $GOOS
let s:goarch = $GOARCH
if len(s:goos) == 0
if exists('g:golang_goos')
let s:goos = g:golang_goos
elseif has('win32') || has('win64')
let s:goos = 'windows'
elseif has('macunix')
let s:goos = 'darwin'
else
let s:goos = '*'
endif
endif
if len(s:goarch) == 0
if exists('g:golang_goarch')
let s:goarch = g:golang_goarch
else
let s:goarch = '*'
endif
endif
let dirs = go#package#Paths()
if len(dirs) == 0
" should not happen
return []
endif
let ret = {}
for dir in dirs
" this may expand to multiple lines
let root = split(expand(dir . '/pkg/' . s:goos . '_' . s:goarch), "\n")
call add(root, expand(dir . '/src'))
for r in root
for i in split(globpath(r, a:ArgLead.'*'), "\n")
if isdirectory(i)
let i .= '/'
elseif i !~ '\.a$'
continue
endif
let i = substitute(substitute(i[len(r)+1:], '[\\]', '/', 'g'),
\ '\.a$', '', 'g')
let ret[i] = i
endfor
endfor
endfor
return sort(keys(ret))
endfunction "}}}2
" {{{2
func! s:RemoveTrailComma()
exec ':%s/,\(\n\r\?.*[}\])]\)/\1/'
endfunction
" }}}2
" }}}1
" General {{{1
" misc {{{2
filetype indent plugin on
" set iskeyword=@,48-57,192-255
let mapleader=','
set backspace=2
set number
set foldmethod=marker
" set textwidth=79
set colorcolumn=+1
set wrap
" set linebreak
set noignorecase
set incsearch " instance search
set wildmenu
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set showmatch
set matchtime=1
set fo+=mt
set cursorline " heighlight current line
" set cursorcolumn
set autochdir
if has('mouse')
set mouse=a
endif
set nobackup
set history=50
set autoread
set autowriteall
let $PATH=$PATH . ':' . expand('~/.cabal/bin')
set path=.,./*/*,../include,/usr/include/,/usr/include/*,/usr/local/include,/usr/include/c++/*/*
set wildignore=*.o,*.obj,*.exe,a.out,*.pdf,*~,*.chm,#*#,*.hi,*.error*
set hidden
set bufhidden=delete
set timeoutlen=300
set cb=unnamedplus,autoselect,exclude:cons\|linux
let auto_new_line = 0
" }}}2
if has("win32") " {{{2
set shellslash
"set guifont=DejaVu_Sans_Mono:h12
set guifont=Consolas:h12
set vb t_vb=\". " stop beep
set iskeyword=@,48-57,128-167,224-235
endif
" }}}2
if has("gui_running") " {{{2
set guioptions+=b " v scroll bar
set guioptions-=m " delete menubar
set winaltkeys=no
endif
" }}}2
" color {{{2
" switch syntax highlighting on, when the terminal has colors.
" also switch on highlighting the laast used search pattern.
if &t_Co > 2 || has("gui_running")
syntax enable
set hlsearch
set t_Co=256 " to use molokai in terminal
if &term != "linux" && finddir("molokai", expand("~/.vim/bundle/")) != ""
colorscheme molokai
if !has("gui_running") && transparentBg == 1
hi Normal ctermbg=none
hi LineNr ctermbg=none
hi NonText ctermbg=none
hi Comment ctermfg=228
endif
hi ColorColumn ctermbg=238 guibg=darkgray
else
colorscheme desert
endif
endif
" }}}2
" FIXME: this code is buggy
" {{{2 termguicolors for true color
if has("termguicolors")
" echo "use true color"
" fix bug for vim
" set t_8f=^[[38;2%lu;%lu;%lum
" set t_8b=^[48;2;%lu;%lu;%lum
" enable true coloe
" set termguicolors
endif
" }}}2
" status line {{{2
set laststatus=2
if has("statusline")
set statusline=%!Statusline()
" set statusline=
endif
" }}}2
" Tab line setting {{{2
call TabMap()
" set tabline=%!MyTabLine() " custom tab pages line
" }}}2
" encoding {{{2
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
" set ambiwidth=double
set fileformat=unix
" }}}2
" indent {{{2
filetype indent on
set cin
set autoindent
set smartindent
set smarttab
set tabstop=8 " tab length 8
set cinoptions=:0,l1,g0,(0,W4,j1,m1,N-s,t0,f0
set listchars=tab:>-,eol:†
" set listchars+=trail:⎵
" set listchars+=trail:⌷
" ⌷ † ⍊ ⍛ ♏
" }}}2
" }}}1
" autocmd {{{1
au VimEnter * call ChangeUnimpariedMap()
au FileType gitcommit setlocal textwidth=80
augroup ReadTemplate " {{{2
au!
au BufNewFile README* if !filereadable("%") | 0read ~/.vim/template/README.md | endif
au BufNewFile * call ReadTemplate()
augroup END " }}}2
augroup FileTypeSet " {{{2
au!
au BufReadPost,BufNewFile vim.bundles,vim.bundles.local,vim.local setlocal filetype=vim
au BufReadPost,BufNewFile .vim.bundles,.vim.bundles.local,.vim.local setlocal filetype=vim
au BufReadPost,BufNewFile .xmobarrc,xmobarrc setlocal filetype=haskell
au BufReadPost,BufNewFile *.zsh* setlocal filetype=zsh
au BufReadPost,BufNewFile *.md,*.note setlocal filetype=markdown
au BufReadPost,BufNewFile *.conf setlocal filetype=sh
au BufReadPost,BufNewFile Sconstruct setlocal filetype=python
" au BufReadPost,BufNewFile *.html set filetype=html5
augroup END
" }}}2
augroup SaveEvent " {{{2
au!
" auto source .vimrc when saving
au BufWritePost vimrc,.vimrc,.vimrc.local,vimrc.local,.vim.bundles,vim.bundles,.vim.bundles.local,vim.bundles.local source $MYVIMRC
" au FileType coffee au BufWritePost <buffer> :!if [ -f makefile ] || [ -f Makefile ]; then make > /dev/null; fi
" au FileType c,cpp,python,ruby,markdown,haskell,coffee,xml,vim,javascript
" \ au BufWritePre <buffer> call DeleteTrailingBlank()
augroup END " }}}2
augroup AutoComplete " {{{2
au!
au FileType haskell setlocal omnifunc=necoghc#omnifunc
au FileType python setlocal omnifunc=pythoncomplete#Complete
augroup END
" }}}2
augroup Compiler " {{{2
au!
au FileType go compiler go
augroup END " }}}2
if exists('auto_new_line') && auto_new_line " {{{2
au FileType c,cpp au BufWritePre,FileWritePre,BufUnload <buffer> call AutoNewLine()
endif " }}}2
augroup ListChars " {{{2
au!
au FileType c,cpp,python,haskell,html,markdown,coffee,vim,xml,ruby,css,go
\,javascript,make,sh,zsh,cmake,elm,qml
\ setlocal list
augroup END " }}}2
augroup FileTypeIndent " {{{2
au!
au FileType c,cpp,python,haskell,markdown,coffee,vim,xml,sh,zsh,objc
\,cmake,elm,qml,vala
\ setlocal expandtab
\ shiftwidth=4
\ softtabstop=4
au FileType ruby,css,typescript,javascript,html,html5,eruby,scss,sass,yaml
\ setlocal expandtab
\ shiftwidth=2
\ softtabstop=2
au FileType go setlocal nosmarttab
augroup END " }}}2
" }}}1
" command {{{1
command! -nargs=1 -complete=file CreateNote call CreateNoteFunc(<q-args>)
command! -nargs=* -complete=file Find call Find(<q-args>)
command! -nargs=0 Todo noautocmd vimgrep /TODO\|FIXME/j * | cw
command! -nargs=0 Imports call go#fmt#Format(1)
command! -nargs=1 -complete=customlist,go#package#Complete Import call go#import#SwitchImport(1, '', <f-args>, '<bang>')
command! -nargs=* -complete=customlist,s:goComplete ImportAs call go#import#SwitchImport(1, <f-args>, '<bang>')
" }}}1
" plugin {{{1
runtime! macros/matchit.vim
runtime! ftplugin/man.vim
" let g:gitgutter_enabled=0
let g:gitgutter_max_signs = 10000
let g:rbpt_colorpairs = [
\ ['red', 'firebrick3'],
\ ['brown', 'RoyalBlue3'],
\ ['Darkblue', 'SeaGreen3'],
\ ['darkgreen', 'firebrick3'],
\ ['darkcyan', 'RoyalBlue3'],
\ ['darkred', 'SeaGreen3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['brown', 'firebrick3'],
\ ['red', 'firebrick3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['Darkblue', 'firebrick3'],
\ ['darkgreen', 'RoyalBlue3'],
\ ['darkcyan', 'SeaGreen3'],
\ ['darkred', 'DarkOrchid3'],
\ ['red', 'firebrick3'],
\ ]
" vim-go{{{2
let g:go_highlight_functions=1
let g:go_highlight_methods=1
let g:go_highlight_structs=1
let g:go_highlight_build_constraints=1
" let g:go_fmt_command = "goimports"
" let g:syntasitc_go_checkers=['golint', 'govet', 'errcheck']
" }}}2
" Rainbow Parenthese {{{2
let g:rbpt_max = 16
let g:rbpt_loadcmd_toggle = 0
if finddir("rainbow_parentheses.vim", expand("~/.vim/bundle")) != ""
if &loadplugins == 1
augroup RBPT
au!
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
augroup END
endif
endif
" }}}2
" YCM {{{2
let g:ycm_confirm_extra_conf = 0
let g:ycm_min_num_of_chars_for_completion = 2
let g:ycm_collect_identifiers_from_comments_and_strings = 2
let g:ycm_filepath_completion_use_working_dir = 1
let g:ycm_key_list_select_completion=["<C-N>", "<Down>"]
let g:ycm_key_list_previous_completion=['<C-P>', '<Up>']
let g:ycm_key_invoke_completion='<C-y>'
let g:ycm_add_preview_to_completeopt = 1
let g:ycm_complete_in_comments = 1
let g:ycm_global_ycm_extra_conf = '~/.dotfiles/ycm_extra_conf.py'
let g:ycm_comfirm_extra_conf=0
" let g:ycm_server_log_level='debug'
" let g:ycm_server_keep_logfiles = 1
" }}}2
" tcomment {{{2
" let g:tcommentLineC_fmt = {
" \ 'commentstring': '// %s'
" \ }
" let g:tcommentInlineC = {
" \'commentstring': '// %s'
" \}
" }}}2
" indent-guides {{{2
nmap <leader>g :IndentGuidesToggle<CR>
let g:indent_guides_guide_size = 1
let g:indent_guides_start_level = 2
let g:indent_guides_enable_on_vim_startup = 0
" }}}2
" UltiSnips {{{2
let g:UltiSnipsExpandTrigger="<tab>"
" let g:UltiSnipsListSnippets="<C-tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
" }}}2
" haskell indent " {{{2
" let g:haskell_indent_if = 0
" }}}2
" ctrlp {{{2
let g:ctrlp_show_hidden = 1
let g:ctrlp_tabpage_position='a'
nmap <leader>m :CtrlPMRU<CR>
nmap <leader>b :CtrlPBuffer<CR>
" }}}2
" doxygentoolkit {{{2
" url: http://www.vim.org/scripts/script.php?script_id=987
"let g:doxygentoolkit_commenttype = "c++
let g:doxygentoolkit_authorname="Li Liqiang"
let g:doxygentoolkit_brieftag_funcname = "yes"
let g:doxygentoolkit_brieftag_post="- "
let g:doxygentoolkit_paramtag_post=" - "
let g:doxygentoolkit_returntag="@return - "
let g:doxygentoolkit_filetag="@file - "
let g:doxygentoolkit_versiontag="@version - "
let g:doxygentoolkit_datetag="@date - "
let g:doxygentoolkit_authortag="@author - "
let g:doxygentoolkit_licensetag="@license - "
" map <F3> :Dox<CR>
map <C-F3> :Doxauthor<CR>
" }}}2
" python-dict {{{2
" url: http://www.vim.org/scripts/script.php?script_id=850
" let g:pydiction_location="/home/l/.vim/ftplugin/python_dict/complete-dict"
" let g:pydiction_menu_height=15 " default
" }}}2
" snipmate {{{2
" url: http://www.vim.org/scripts/script.php?script_id=3302
let g:snips_author = 'Li Liqiang'
" }}}2
" vimim {{{2
" let g:vimim_map = 'c-bslash'
" }}}2
" vim-latex {{{2
" starting with vim 7, the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" the following changes the default filetype back to 'tex':
" let g:tex_flavor='latex'
" }}}2
" syntastic {{{2
"let g:syntastic_check_on_open=1
let g:syntastic_mode_map = {
\ 'mode': 'passive',
\ 'active_filetypes': [],
\ 'passive_filetypes':[]
\ }
let g:syntastic_error_symbol='x'
let g:syntastic_cpp_check_header = 1
let g:syntastic_cpp_compiler='clang++'
let g:syntastic_cpp_compiler_options=' -std=c++0x'
let g:syntastic_cpp_auto_refresh_includes = 1
nmap <leader><leader>e :Error<CR>
nmap <leader><leader>c :SyntasticCheck<CR>
nmap <leader><leader>t :SyntasticToggleMode<CR>
" }}}2
" }}}1
" mapping {{{1
nnoremap ^ g0
nnoremap 0 g^
nnoremap g^ 0
nnoremap g0 ^
nnoremap gj j
nnoremap gk k
nnoremap j gj
nnoremap k gk
nmap <leader>rc :call OpenVimrc()<CR>
nmap <leader>r :so $MYVIMRC<CR>
" nmap <leader>c :lcd %:p:h<CR>
nmap <leader>d :bd<CR>
nmap <C-S> <ESC>:w<CR>
nmap <leader>w <ESC>:w<CR>
nmap <F6> :call Cfamilyformat()<cr>
nmap <F8> :%s///g
nmap <C-N><C-H> :nohls<CR>
" nmap <f2> :helptags ~/.vim/doc<cr>
nmap gl $
nmap <leader>i :call Insertdomain()<CR>
nmap <leader>f :NERDTreeToggle<CR>
nmap <leader>t :TagbarToggle<CR>
nmap <leader>to :Todo<CR>
" to avoid popup menu in ubuntu
imap <F10> <NOP>
nmap <F10> <NOP>
imap <C-L> <C-O>:call Emacs_ctrl_l()<CR>
nmap <C-L> :call Emacs_ctrl_l()<CR>
nnoremap <leader>l <C-L>
nmap <C-H> :h<space>
nmap <leader>ec :set fileencoding=utf8
" map <C-A> to move cursor to the begin of line
cmap <C-D> <Del>
" TODO: TBD
cnoremap <C-\> <C-D>
cnoremap <C-A> <C-B>
cmap <C-B> <Left>
cmap <C-F> <Right>
cmap <Esc>b <S-Left>
cmap <Esc>f <S-Right>
nmap <leader>a :Ag<CR>
nmap <silent> <leader>c :cclose<CR>:pc<CR>
nmap o :tabnew<space>
nmap <c-F3> :cn<CR>
nmap <S-F3> :cp<CR>
nmap <leader>o :copen<CR>
nmap 1 <C-W>o
nmap <leader>q :qa!<CR>
" turn off <C-Space>
imap <Nul> <Space>
nmap <leader><leader>a :Find<CR>
"map <F11> :!find -name '*.h' -o -name '*.c' \| ctags -R --c++-kinds=+px --fields=+iaS --extra=+q -L<CR>
map <C-\> :tab split<CR>:exec("tag ".expand("<cword>"))<CR>
map <A-]> :vsp <CR>:exec("tag ".expand("<cword>"))<CR>
" }}}1
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)