-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_vimrc
More file actions
1148 lines (1018 loc) · 35.1 KB
/
_vimrc
File metadata and controls
1148 lines (1018 loc) · 35.1 KB
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
" Elvin's vim config: 2015/9/18
"
" Put this under ~/.vim folder
" Add below codes into the original _vimrc if necessary
" source ~/.vim/_vimrc
" Copy all files in Exe folder into the vim74 folder if using MS-Vim
"
set nocompatible
" Tag files generation
if has('win32') || has('win64')
let g:iswindows="1"
else
let g:iswindows="0"
endif
" Auto reload your Vimrc
"
augroup reload_vimrc " {
autocmd!
autocmd BufWritePost $MYVIMRC source $MYVIMRC
augroup END " }
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set bomb
"
" Setup folder structure
"
if !isdirectory(expand('~/.vim/undo/', 1))
silent call mkdir(expand('~/.vim/undo', 1), 'p')
endif
if !isdirectory(expand('~/.vim/backup/', 1))
silent call mkdir(expand('~/.vim/backup', 1), 'p')
endif
if !isdirectory(expand('~/.vim/swap/', 1))
silent call mkdir(expand('~/.vim/swap', 1), 'p')
endif
" No backup file
set nobackup
" set backup
" set writebackup
" Use a specified swap folder
" Source
" http://stackoverflow.com/a/15317146
set directory=~/.vim/swap//
" Turn on persistent undo
" Thanks, Mr Wadsten: github.com/mikewadsten/dotfiles/
if has('persistent_undo')
set undodir=~/.vim/undo//
set undofile
set undolevels=1000
set undoreload=10000
endif
" The default 20 isn't nearly enough
set history=9999
" Set fileencodings=utf-8,chinese,latin-1
"
set fileencodings=ucs-bom,utf-8,GB2312,cp936,gb18030,big5,euc-jp,euc-kr,latin1,chinese
set fileencoding=utf-8
" Use UTF-8 encoding
set encoding=utf-8
" Solve menu messy code
"
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
" Change the <Leader> key
let mapleader = ","
" Solve messy code of Chinese. Don't do this if using English OS
"
if (g:iswindows==1)
language messages zh_CN.utf-8
endif
" File format
"
set fileformats=unix,dos
nmap <silent>fd :se ff=dos<cr>
nmap <silent>fu :se ff=unix<cr>
" Parentheses pairing
"
"set sm
" vim uncompatible
"
set nocp
" Tab width
"
set sw=4
set tabstop=4
set cindent shiftwidth=4
set autoindent shiftwidth=4
set smarttab "use shiftwidth when inserting tab
set expandtab "replace tab with space
" Change tab/indent/shift width to 2
"
nmap t2 :se sw=2 ts=2 cindent shiftwidth=2 autoindent shiftwidth=2<CR>
" Change tab/indent/shift width to 4
"
nmap t4 :se sw=4 ts=4 cindent shiftwidth=4 autoindent shiftwidth=4<CR>
" Add mouse support
"
set mouse=a
" Auto load file if it is changed by other process
"
set autoread
" Status line
"
set laststatus=2
" Status line color
"
highlight StatusLine guifg=SlateBlue guibg=White
highlight StatusLineNC guifg=Gray guibg=White
" Make case-sensitive search intelligently
"
set ignorecase
set smartcase
" GUI font
if g:iswindows == 1
set guifont=Monospace\ 10
"set guifont=Envy_Code_R_VS:h12:cANSI
"set guifont=Courier_New:h10:cANSI
endif
filetype plugin indent on " Auto completion
set autoindent
set nocp " Close Vi compatible mode
set completeopt=longest,menu
" Highlight charactor, make them not limited to 100 colums
"
:highlight OverLength ctermbg=red ctermfg=white guibg=red guifg=white
:match OverLength '\%101v.*'
" Parentheses pairing, incuding brace
"
" ()need to remove echofunc.vim
":inoremap ( ()<ESC>i
":inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {}<ESC>i
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
":inoremap < <><ESC>i
":inoremap > <c-r>=ClosePair('>')<CR>
" Jump to the line when it exited last time
"
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
" Highlight current line
if has("gui_running")
autocmd InsertLeave * se nocul
autocmd InsertEnter * se cul
endif
" Maxmize window
if g:iswindows == 1
autocmd GUIEnter * simalt ~x
endif
" Hide menu and tool bar
set guioptions-=m
set guioptions-=T
map <silent> menu :if &guioptions =~# 'T' <Bar>
\set guioptions-=T <Bar>
\set guioptions-=m <bar>
\else <Bar>
\set guioptions+=T <Bar>
\set guioptions+=m <Bar>
\endif<CR>
" Save global parameters
"
set viminfo+=!
" Show blank space between splitted windows
set fillchars=vert:\ ,stl:\ ,stlnc:\
" Don't change line number on below chars
set iskeyword+=_,$,@,%,#,-
" Don't blink
set novisualbell
" Show line number
"
set nu!
" Show relative number
set rnu!
" Remap <C-h,j,k,l> to navigate up, down, left, right among windows
" Nav up
noremap <C-K> <C-W>k
" Nav down
noremap <C-J> <C-W>j
" Nav left
noremap <C-H> <C-W>h
" Nav right
noremap <C-L> <C-W>l
" Expand left
noremap <C-Left> <C-W><
" Expand right
noremap <C-Right> <C-W>>
" Expand up
noremap <C-Up> :resize -5<cr>
" Expand down
noremap <C-Down> :resize +5<cr>
if (g:iswindows==1)
" Alpha Window
map tw : call libcallnr("vimtweak.dll", "SetAlpha",220)<cr>
map tW : call libcallnr("vimtweak.dll","SetAlpha",255)<cr>
" Maximize Window
map mW : call libcallnr("vimtweak.dll", "EnableMaximize", 1)<cr>
map mw : call libcallnr("vimtweak.dll", "EnableMaximize", 0)<cr>
endif "g:iswindows==1
" Add file type
" Add inf, dec, fdf, dsc, hfr, vfr, hfi, vfi file type
au BufNewFile,BufRead *.asl,*.asi,*.itp setf cpp
au BufNewFile,BufRead *.hfr,*.hfi,*.vfr,*.vfi setf cpp
au BufNewFile,BufRead *.inf,*.dec,*.fdf,*.dsc setf make
au BufNewFile,BufRead *.conf setf make
" Quicker Escaping
inoremap jj <ESC>
" Drop Vim's crazy regex charactors and use normal regex similar with
" Perl/Python
nnoremap / /\v
vnoremap / /\v
" map ','+space to canel hightlight
nnoremap <leader><space> :noh<cr>
" Save on losing focus
au FocusLost * :wa!
" Syntax complete
if has("autocmd") && exists("+omnifunc")
autocmd Filetype *
\ if &omnifunc == "" |
\ setlocal omnifunc=syntaxcomplete#Complete |
\ endif
endif
" Highlight column
"set cc=81
" Quickly replace current word
"nmap <A-s> :%s/\<<C-r><C-w>\>//g<Left><Left>
nmap <leader>s :%s/\<<C-r><C-w>\>//g<Left><Left>
" Quickly replace the trailing space char
nmap cS :%s/\s\+$//g<CR>:noh<CR>
" Quickly replace the trailing ^M char
nmap cM :%s/\r$//g<CR>:noh<CR>
" Disable popup menu when mouse hovering
" It is really annoying and always crash... :)
if (g:iswindows==1)
set balloondelay=1000000
setlocal balloonexpr=
endif
"
" Custom Functions
"
" Remove trailing whitespace
" http://vim.wikia.com/wiki/Remove_unwanted_spaces
function! StripTrailingWhitespace()
if !&binary && &filetype != 'diff'
normal mz
normal Hmy
%s/\s\+$//e
normal 'yz<cr>
normal `z
retab
endif
endfunction
nmap <leader>tW :cal StripTrailingWhitespace()<cr>
" Auto load tags file(upward recursively)
"
set tags=tags;
if (g:iswindows==1)
set tags+=E:\Elvin\Code\fx3_sdk_1_3_3_src\tags
endif
"set tags+=./addtags/qt5_h
set autochdir
" Create tags file
nnoremap tag :call CreateCtags()<CR>
" Create cscope file
nnoremap cs :call CreateCscope()<CR>
" Shortcut for 'cs find'
nnoremap cf :cs find
" use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t'
set cscopetag
" check cscope for definition of a symbol before checking ctags: set to 0
" if you want the reverse search order.
set csto=1
" show msg when any other cscope db added
set cscopeverbose
"cs find c|d|e|f|g|i|s|t name
" 's' symbol: find all references to the token under cursor
" 'g' global: find global definition(s) of the token under cursor
" 'c' calls: find all calls to the function name under cursor
" 't' text: find all instances of the text under cursor
" 'e' egrep: egrep search for the word under cursor
" 'f' file: open the filename under cursor
" 'i' includes: find files that include the filename under cursor
" 'd' called: find functions that function under cursor calls
nmap <C-\>? :map <C-\><cr>
nmap <C-\>c :ec 'Find all calls to function' <bar> cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>d :ec 'Find functions that call this function' <bar> cs find d <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>e :ec 'egrep search for the word under cursor' <bar> cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>f :ec 'Open filename under cursor' <bar> cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-\>g :ec 'Find all global definitions' <bar> cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>i :ec 'Find files that include the filename' <bar> cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-\>s :ec 'Find all references' <bar> cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>t :ec 'Find all instances to text' <bar> cs find t <C-R>=expand("<cword>")<CR><CR>
" Create cscope.out
function! CreateCscope()
let dir = getcwd()
let save_path = getcwd()
let last_path = ""
let cur_path = getcwd()
" Assume that '.git' is the root path, try to find it
" If can't find, use the previous working path
while last_path != cur_path
if isdirectory(".git")
let dir = cur_path
break
endif
let last_path = cur_path
silent! execute "lcd .."
let cur_path = getcwd()
endwhile
" Switch to the directory to run cscope
silent! execute 'cd ' . dir
if filereadable("cscope.files")
if(g:iswindows==1)
let csfilesdeleted=delete(dir."\\"."cscope.files")
else
let csfilesdeleted=delete("./"."cscope.files")
endif
if(csfilesdeleted!=0)
echohl WarningMsg | echo "Fail to do cscope! I cannot delete the cscope.files" | echohl None
return
endif
endif
if filereadable("cscope.out")
if has("cscope")
silent! execute "cs kill -1"
endif
if(g:iswindows==1)
let csoutdeleted=delete(dir."\\"."cscope.out")
else
let csoutdeleted=delete("./"."cscope.out")
endif
if (csoutdeleted!=0)
if (g:iswindows==1)
silent! execute "!taskkill /F /IM cscope.exe"
else
" TODO, add linux command here
endif
if(g:iswindows==1)
let csoutdeleted=delete(dir."\\"."cscope.out")
else
let csoutdeleted=delete("./"."cscope.out")
endif
endif
if(csoutdeleted!=0)
echohl WarningMsg | echo "Fail to do cscope! I cannot delete the cscope.out" | echohl None
return
endif
endif
if(executable('cscope') && has("cscope") )
if(g:iswindows==1)
silent! execute "!dir /s/b *.c,*.cpp,*.h,*.hpp,*.cc,*.asm,*.S,*.inc,"
\"*.java,*.cs,*.py,*.php,"
\"*.asl,*.asi,"
\"*.dec,*.dsc,*.inf,*.fdf,"
\"*.ino,"
\"*.hfr,*.hfi,*.vfr,*.vfi > cscope.files"
else
silent! execute "!find ".dir." -name '*.h' "
\"-o -name '*.hpp' "
\"-o -name '*.c' "
\"-o -name '*.asm' "
\"-o -name '*.S' "
\"-o -name '*.cpp' "
\"-o -name '*.cc' "
\"-o -name '*.php' "
\"-o -name '*.java' "
\"-o -name '*.cs' > cscope.files"
endif
if(g:iswindows==1)
silent! exec '!start /min cmd /c "cscope -b'
\ ' & vim --servername '.v:servername.' --remote-expr "LoadCscopeVimStart()"'
\ ' "'
else
execute "!cscope -b"
call AddCscope()
endif
endif
silent! execute 'cd ' . save_path
endfunction
" Generate Cscope database and ctags
function! CreateCsTag()
call CreateCtags()
call CreateCscope()
endfunction
" Generate ctags
function! CreateCtags()
let dir = getcwd()
let save_path = getcwd()
let last_path = ""
let cur_path = getcwd()
" Assume that '.git' is the root path, try to find it
" If can't find, use the previous working path
while last_path != cur_path
if isdirectory(".git")
let dir = cur_path
break
endif
let last_path = cur_path
silent! execute "lcd .."
let cur_path = getcwd()
endwhile
" Switch to the directory to run cscope
silent! execute 'cd ' . dir
if filereadable("tags")
if(g:iswindows==1)
let tagsdeleted=delete(dir."\\"."tags")
else
let tagsdeleted=delete("./"."tags")
endif
if(tagsdeleted!=0)
echohl WarningMsg | echo "Fail to do tags! I cannot delete the tags" | echohl None
return
endif
endif
if(executable('ctags'))
if(g:iswindows==1)
silent! exec '!start /min cmd /c '
\ '"ctags -R --c++-kinds=+p --fields=+iaS '
\ '--exclude=.git '
\ '--exclude=*.exe '
\ '--exclude=*.bin '
\ '--exclude=*.obj '
\ '--exclude=*.efi'
\ '--exclude=*.txt'
\ '--exclude=*.dll'
\ '--exclude=*.lib'
\ '--exclude=*.so'
\ '--exclude=*.so.*'
\ '--extra=+q .'
\ ' & vim --servername '.v:servername.' --remote-expr "AddCtags()"'
\ ' "'
else
execute "!ctags -R --c++-kinds=+p --fields=+iaS "
\"--exclude=.git "
\"--exclude=*.exe "
\"--exclude=*.bin "
\ '--exclude=*.txt'
\ '--exclude=*.dll'
\ '--exclude=*.lib'
\ '--exclude=*.so'
\"--exclude=*.obj "
\"--extra=+q ."
call AddCtags()
endif
endif
silent! execute 'cd ' . save_path
endfunction
" Add ctags
function! AddCtags()
if filereadable("tags")
set tags+=tags
endif
endfunction
" Load cscope.out if the file exists in CWD
function! AddCscope()
execute "normal :"
if filereadable("cscope.out")
execute "cs add cscope.out"
endif
endfunction
" Auto load cscope.out when entering Gvim
autocmd GUIEnter * call LoadCscopeVimStart()
command! -nargs=* -complete=file LoadCscopeRecur
\ call LoadCscopeVimStart()
function! LoadCscopeVimStart()
let last_path = ""
let cur_path = getcwd()
let store_path = cur_path
while last_path != cur_path
if filereadable("cscope.out")
silent! execute "cs add cscope.out"
"execute "cs add cscope.out"
break
endif
let last_path = cur_path
silent! execute "lcd .."
let cur_path = getcwd()
endwhile
silent! execute 'cd ' . store_path
endfunction
"autocmd! BufEnter * nested call InTabBar()
func! InTabBar()
if bufname("%") == "-MiniBufExplorer-"
wincmd j " jump down
endif
endfunction
" Clear all buffers except the current one
if !exists(':ClearBuf')
command! ClearBuf call ClearBuffer()
endif
" Clear the buffers except the current one
function! ClearBuffer()
let i = 1
while i <= bufnr('$')
if buflisted(i) && (bufnr('%') != i)
\ && (bufwinnr(i) == -1)
exe "bdel!" i
endif
let i += 1
endwhile
endfunction
" ***************************************************
" Hex Edit
" ***************************************************
" ex command for toggling hex mode - define mapping if desired
command! -bar Hexmode call ToggleHex()
" helper function to toggle hex mode
function! ToggleHex()
" hex mode should be considered a read-only operation
" save values for modified and read-only for restoration later,
" and clear the read-only flag for now
let l:modified=&mod
let l:oldreadonly=&readonly
let &readonly=0
let l:oldmodifiable=&modifiable
let &modifiable=1
if !exists("b:editHex") || !b:editHex
" save old options
let b:oldft=&ft
let b:oldbin=&bin
" set new options
setlocal binary " make sure it overrides any textwidth, etc.
let &ft="xxd"
" set status
let b:editHex=1
" switch to hex editor
%!xxd
else
" restore old options
let &ft=b:oldft
if !b:oldbin
setlocal nobinary
endif
" set status
let b:editHex=0
" return to normal editing
%!xxd -r
endif
" restore values for modified and read only state
let &mod=l:modified
let &readonly=l:oldreadonly
let &modifiable=l:oldmodifiable
endfunction
" autocmds to automatically enter hex mode and handle file writes properly
if has("autocmd")
" vim -b : edit binary using xxd-format!
augroup Binary
au!
" set binary option for all binary files before reading them
au BufReadPre *.bin,*.hex,*.ROM,*.cap setlocal binary
" if on a fresh read the buffer variable is already set, it's wrong
au BufReadPost *
\ if exists('b:editHex') && b:editHex |
\ let b:editHex = 0 |
\ endif
" convert to hex on startup for binary files automatically
au BufReadPost *
\ if &binary | Hexmode | endif
" When the text is freed, the next time the buffer is made active it will
" re-read the text and thus not match the correct mode, we will need to
" convert it again if the buffer is again loaded.
au BufUnload *
\ if getbufvar(expand("<afile>"), 'editHex') == 1 |
\ call setbufvar(expand("<afile>"), 'editHex', 0) |
\ endif
" before writing a file when editing in hex mode, convert back to non-hex
au BufWritePre *
\ if exists("b:editHex") && b:editHex && &binary |
\ let oldro=&ro | let &ro=0 |
\ let oldma=&ma | let &ma=1 |
\ silent exe "%!xxd -r" |
\ let &ma=oldma | let &ro=oldro |
\ unlet oldma | unlet oldro |
\ endif
" after writing a binary file, if we're in hex mode, restore hex mode
au BufWritePost *
\ if exists("b:editHex") && b:editHex && &binary |
\ let oldro=&ro | let &ro=0 |
\ let oldma=&ma | let &ma=1 |
\ silent exe "%!xxd" |
\ exe "set nomod" |
\ let &ma=oldma | let &ro=oldro |
\ unlet oldma | unlet oldro |
\ endif
augroup END
endif
" Hex Edit End
" Load EDK2 build log file
function! LoadBuildLog()
let defLogFile = "build.log"
let logFile = input("Log file name: ", defLogFile)
let lastPath = ""
let curPath = getcwd()
let storePath = curPath
while lastPath != curPath
if filereadable(logFile)
break
endif
let lastPath = curPath
execute "lcd .."
let curPath = getcwd()
endwhile
if exists(":cgetfile")
execute "silent! cgetfile " . logFile
else
execute "silent! cfile " . logFile
endif
botright copen
execute "cd " . storePath
endfunction
command! -nargs=* -complete=file LoadLogFile
\ call LoadBuildLog()
" Load and open the build log file
nmap <leader>log :LoadLogFile <cr>
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" We could also add repositories with a ".git" extension
Plugin 'scrooloose/nerdtree.git'
Plugin 'scrooloose/nerdcommenter'
Plugin 'majutsushi/tagbar'
Plugin 'vim-scripts/desertEx'
Plugin 'mbbill/echofunc'
"Plugin 'Shougo/neocomplete.vim'
"Plugin 'Shougo/neocomplcache.vim'
Plugin 'ervandew/supertab'
Plugin 'kien/ctrlp.vim'
"Plugin 'vim-scripts/mru.vim'
Plugin 'bling/vim-airline'
Plugin 'vim-scripts/DirDiff.vim'
Plugin 'oplatek/Conque-Shell'
Plugin 'klen/python-mode'
Plugin 'vim-scripts/matrix.vim--Yang'
Plugin 'sjl/gundo.vim'
Plugin 'mrtazz/DoxygenToolkit.vim'
Plugin 'vim-scripts/a.vim'
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
Plugin 'junegunn/vim-easy-align'
Plugin 'vim-scripts/SearchComplete'
Plugin 'tomasr/molokai'
Plugin 'mkarmona/colorsbox'
Plugin 'easymotion/vim-easymotion'
Plugin 'kshenoy/vim-signature'
Plugin 'tpope/vim-speeddating'
"Plugin 'jceb/vim-orgmode'
Plugin 'Yggdroot/indentLine'
"Plugin 'vim-scripts/YankRing.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'Valloric/YouCompleteMe'
"Plugin 'stevearc/vim-arduino'
Plugin 'gregsexton/gitv'
Plugin 'terryma/vim-smooth-scroll'
Plugin 'file://~/.vim/bundle/myplugin'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
syntax enable
syntax on
" Syntax highlight
colorscheme desertEx
"colorscheme molokai
"colorscheme blackdust
" ***************************************************
" ervandew/supertab
" ***************************************************
let g:SuperTabRetainCompletionType = 2
let g:SuperTabDefaultCompletionType = "<C-N>"
"let g:SuperTabDefaultCompletionType = "<C-X><C-O>" 0
" ***************************************************
" neocomplcache-8.0
" ***************************************************
"let g:neocomplcache_enable_at_startup = 1
""let g:neocomplcache_enable_auto_select = 1
"if !exists('g:neocomplcache_omni_patterns')
"let g:neocomplcache_omni_patterns = {}
"endif
"let g:neocomplcache_omni_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
"let g:neocomplcache_omni_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)'
"let g:neocomplcache_omni_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
"" <TAB>: completion.
"inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
"" Define dictionary.
"" TXT English word completion
"let g:neocomplcache_dictionary_filetype_lists = {
"\ 'default' : '',
"\ 'txt' : $VIMRUNTIME.'/dict/english.dic',
"\ }
"" The menu style of auto-complete
"set wildmenu
"autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
"autocmd FileType python set omnifunc=pythoncomplete#Complete
"autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
"autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
"autocmd FileType css set omnifunc=csscomplete#CompleteCSS
"autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
"autocmd FileType java set omnifunc=javacomplete#Complet
"autocmd FileType cs set omnifunc=ccomplete#Complete
" ***************************************************
" neocomplete.vim
" ***************************************************
"Note: This option must be set in .vimrc(_vimrc). NOT IN .gvimrc(_gvimrc)!
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplete.
let g:neocomplete#enable_at_startup = 1
" Use smartcase.
let g:neocomplete#enable_smart_case = 1
" Set minimum syntax keyword length.
let g:neocomplete#sources#syntax#min_keyword_length = 3
let g:neocomplete#lock_buffer_name_pattern = '\*ku\*'
" Define dictionary.
let g:neocomplete#sources#dictionary#dictionaries = {
\ 'default' : '',
\ 'vimshell' : $HOME.'/.vimshell_hist',
\ 'scheme' : $HOME.'/.gosh_completions'
\ }
" Define keyword.
if !exists('g:neocomplete#keyword_patterns')
let g:neocomplete#keyword_patterns = {}
endif
let g:neocomplete#keyword_patterns['default'] = '\h\w*'
" Plugin key-mappings.
inoremap <expr><C-g> neocomplete#undo_completion()
inoremap <expr><C-l> neocomplete#complete_common_string()
" Recommended key-mappings.
" <CR>: close popup and save indent.
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
return (pumvisible() ? "\<C-y>" : "" ) . "\<CR>"
" For no inserting <CR> key.
"return pumvisible() ? "\<C-y>" : "\<CR>"
endfunction
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" <C-h>, <BS>: close popup and delete backword char.
"inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
"inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
" Close popup by <Space>.
"inoremap <expr><Space> pumvisible() ? "\<C-y>" : "\<Space>"
" AutoComplPop like behavior.
"let g:neocomplete#enable_auto_select = 1
" Shell like behavior(not recommended).
"set completeopt+=longest
"let g:neocomplete#enable_auto_select = 1
"let g:neocomplete#disable_auto_complete = 1
"inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<C-x>\<C-u>"
" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
autocmd FileType java set omnifunc=javacomplete#Complet
" Enable heavy omni completion.
if !exists('g:neocomplete#sources#omni#input_patterns')
let g:neocomplete#sources#omni#input_patterns = {}
endif
let g:neocomplete#sources#omni#input_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
let g:neocomplete#sources#omni#input_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)'
let g:neocomplete#sources#omni#input_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
" For perlomni.vim setting.
" https://github.com/c9s/perlomni.vim
let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
" ***************************************************
" majutsushi/tagbar
" ***************************************************
" TarBar, a better plugin than Taglist
nnoremap tl :TagbarToggle<CR>
let g:tagbar_sort = 0
" ***************************************************
" kien/ctrlp.vim
" ***************************************************
" Ctrl-P plug in
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'
if(g:iswindows==1)
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows
else
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
endif
"let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\v\.(exe|so|dll)$',
\ 'link': 'some_bad_symbolic_links',
\ }
if(g:iswindows==1)
let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows
else
let g:ctrlp_user_command = 'find %s -type f' " MacOSX/Linux
endif
" Use a leader instead of the actual named binding
nmap <leader>p :CtrlP<cr>
" Easy bindings for its various modes
nmap <leader>bb :CtrlPBuffer<cr>
nmap <leader>bm :CtrlPMixed<cr>
nmap <leader>bs :CtrlPMRU<cr>
let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:20,results:20'
" ***************************************************
" scrooloose/nerdtree
" ***************************************************
" Use NERD to replace WinManager now!
nmap wm :NERDTreeToggle<cr>
let NERDTreeShowHidden=1
" ***************************************************
" powerline/powerline
" ***************************************************
" Disable Powerline cache, otherwise WIN8/WIN8.1 would report error
let g:Powerline_cache_enabled = 0
" ***************************************************
" vim-scripts/DirDiff.vim
" ***************************************************
"# DirDiff settings
"# Don't compare directories or filenames that match conditions like CVS,*.swp
let g:DirDiffExcludes = "system,CVS,*.class,*.exe,.*.swp"
"# Ignore lines that Id:,Revision: etc.
let g:DirDiffIgnore = "Id:,Revision:,Date:"
"# Don't flag files as different based on whitespace
let g:DirDiffAddArgs = "-w"
"# au FilterWritePre * if &diff is to properly catch the transition to diff mode
"# When in diff mode map space bar to go down to next diff and center the page (z.). Shift-space to go up a diff
au FilterWritePre * if &diff | exe 'noremap <space> ]cz.' | exe 'noremap <S-space> [cz.' | endif
"# When in diff mode convenience map diffput and diffget
au FilterWritePre * if &diff | exe 'noremap <leader>g :diffget<CR>' | exe 'noremap <leader>p :diffput<CR>' | endif
"# When in diff mode convenience map undoing a diffput. Don't go without this one as it is a 3 step process.
au FilterWritePre * if &diff | exe 'nmap <leader>u :wincmd l<CR>:normal u<CR>:wincmd h<CR>' | endif
"# When in diff mode suppress annoying auto-folding (filler,context:1000) and don't check for white space differences
au FilterWritePre * if &diff | exe 'set diffopt=filler,context:1000,iwhite' | exe 'execute "normal \<c-w>\<c-w>"' | endif
" Turn on diff mode
nmap <leader>df :diffthis<cr>
" Turn off diff mode
nmap <leader>de :diffoff<cr>
" ***************************************************
" oplatek/Conque-Shell
" ***************************************************
" Terminal in vim
"---Conque Shell
"Require Vim7.3 + Python2.7
let g:ConqueTerm_PyVersion = 2
let g:ConqueTerm_FastMode = 0
let g:ConqueTerm_Color = 0
let g:ConqueTerm_ReadUnfocused = 1
let g:ConqueTerm_InsertOnEnter = 1
let g:ConqueTerm_CloseOnEnd = 0
"let g:ConqueTerm_PromptRegex = '^\w\+@[0-9A-Za-z_.-]\+:[0-9A-Za-z_./\~,:-]\+\$'
let g:ConqueTerm_Syntax = 'conque'
"let g:ConqueTerm_EscKey = '<Esc>'
"let g:ConqueTerm_ColorMode = 'conceal'
nmap term : ConqueTermSplit cmd<cr>
" ***************************************************
" mbbill/echofunc
" ***************************************************
" echofunc.vim
let g:EchoFuncShowOnStatus = 1
" Status line content, it won't take effect when Plugin Airline was used
"set statusline=[%n]%<%f%y%h%m%r%=[%b\ 0x%B]\ %l\ of\ %L,%c%V\ Page\ %N\ %P
"set statusline=[%n]%<%f%y%h%m%r%=%{EchoFuncGetStatusLine()}\ \ [%b\ 0x%B]\ %l\ of\ %L,%c%V\ Page\ %N\ %P
" ***************************************************
" sjl/gundo.vim
" ***************************************************
" Gundo : Visualize your undo tree.
nnoremap <leader>gu :GundoToggle<cr>
" ***************************************************
" mrtazz/DoxygenToolkit.vim
" ***************************************************
let load_doxygen_syntax = 1
map <leader>dx : Dox<cr>
let g:DoxygenToolkit_briefTag_funcName = "yes"
let g:DoxygenToolkit_briefTag_pre="@brief "
let g:DoxygenToolkit_paramTag_pre="@param "
let g:DoxygenToolkit_returnTag="@return "
let g:DoxygenToolkit_blockHeader="--------------------------------------------------------------------------"
let g:DoxygenToolkit_blockFooter="--------------------------------------------------------------------------"
"let g:DoxygenToolkit_authorName="Huang Kangying"
"let g:DoxygenToolkit_licenseTag="My own license"
" ***************************************************
" vim-scripts/a.vim
" ***************************************************