-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
746 lines (643 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
" let s:ProjectDir="my-project-tags"
let s:ProjectDir="."
" disable some plugin
let g:pathogen_disabled = []
" call add(g:pathogen_disabled, 'clang_complete')
" call add(g:pathogen_disabled, 'neocomplcache-clang_complete')
" call add(g:pathogen_disabled, 'snipMate_HW')
call add(g:pathogen_disabled, 'echofunc')
call add(g:pathogen_disabled, 'OmniCppComplete') "must be the last one
if filereadable(s:ProjectDir."/tags")
call add(g:pathogen_disabled, 'clang_complete')
call add(g:pathogen_disabled, 'neocomplcache-clang_complete')
endif
if filereadable(s:ProjectDir."/project-setting.vim") "工程配置文件的名字
exec "source ".s:ProjectDir."/project-setting.vim"
endif
filetype off
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
"vim: set fenc=utf-8:
set nocompatible
" source $VIMRUNTIME/vimrc_example.vim
"source $VIMRUNTIME/mswin.vim
"behave mswin
if has("gui_running")
set encoding=chinese
set fileencodings=ucs-bom,utf-8,cp936,big5,euc-jp,euc-kr,latin1
if has("win32")
set fileencoding=chinese
else
set fileencoding=utf-8
endif
let &termencoding=&encoding
" 解决菜单乱码
" set langmenu=zh_CN.utf-8
" source $VIMRUNTIME/delmenu.vim
" source $VIMRUNTIME/menu.vim
" 解决consle输出乱码
language messages en_US.utf-8
set background=dark
" colorscheme oceandeep
colorscheme desertEx
" colorscheme wombat
" colorscheme solarized
else
if has("win32")
set encoding=cp936
else
set encoding=utf-8
endif
set fileencodings=ucs-bom,utf-8,cp936,big5,euc-jp,euc-kr,latin1
if has("win32")
set fileencoding=cp936
set termencoding=cp936
else
set fileencoding=utf-8
set termencoding=utf-8
endif
set t_Co=256
set background=dark
colorscheme wombat256
" colorscheme solarized
map <ESC>[32~ <S-F8> "let <S-F8> work for me
endif
"let &termencoding=&encoding
if has("gui_running")
" set gfn=Monaco\ 11
" set gfn=YaHei\ Consolas\ Hybrid\ 11
"set gfn=YaheiMono\ 10
" set gfn=Liberation\ Mono\ 11
" set gfn=Ubuntu\ Mono\ 12
set gfn=Bitstream\ Vera\ Sans\ Mono\ 11
" set gfn=WenQuanYi\ Micro\ Hei\ Mono\ 10
endif
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set wildmode=longest,list
set wildmenu
"最大化
if has('win32')
au GUIEnter * simalt ~x
else
au GUIEnter * call MaximizeWindow()
endif
function! MaximizeWindow()
silent !wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz
endfunction
autocmd BufEnter * :syntax sync fromstart
"去掉鼠标功能
set mouse-=a
"光标不闪
set gcr=a:blinkon0
"设置','为leader快捷键
let mapleader = ","
let g:mapleader = ","
filetype off
"Enable filetype plugin
filetype plugin indent on
"custom file type
au BufNewFile,BufRead *.inc set filetype=C
au BufNewFile,BufRead *.INC set filetype=C
au BufNewFile,BufRead *.MK set filetype=make
au BufNewFile,BufRead *.mk set filetype=make
"remove spaces
nmap <f12> :%s= *$==<cr>
nmap <leader>o :only<cr>
"Fast saving
nmap <silent> <leader>ww :w<cr>
nmap <silent> <leader>WW :w<cr>
nmap <silent> <leader>wf :w!<cr>
nmap <silent> <leader>WF :w!<cr>
"Fast quiting
nmap <silent> <leader>qw :wq<cr>
nmap <silent> <leader>qf :q!<cr>
nmap <silent> <leader>qq :cclose<cr>:q<cr>
nmap <silent> <leader>qa :qa<cr>
"search
vnoremap <silent> ,/ y/<C-R>=escape(@", '\\/.*$^~[]')<CR><CR>
vnoremap <silent> ,? y?<C-R>=escape(@", '\\/.*$^~[]')<CR><CR>
"Fast remove highlight search
nmap <silent> <SPACE> :nohl<cr>
"Fast redraw
nmap <silent> <leader>rr :redraw!<cr>
set nolinebreak
set wrap
set number
set so=1
set sidescrolloff=1
set sidescroll=1
set makeprg=make
set tabstop=4
set softtabstop=4
set shiftwidth=4
syn on
compiler gcc
set guioptions-=T
set guioptions-=r
set guioptions-=L
set guioptions+=i
set guioptions-=m
set guioptions+=c
set fileformat=unix
"set fileformats=unix
set cindent
set autoindent
set nocompatible
set expandtab
set smarttab
set linespace=0
set foldopen-=search " don't open folds when you search into them
set foldopen-=undo " don't open folds when you undo stuff
set fsync
set laststatus=2
""set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\[HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]
""set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [POS=%04l,%03v][%p%%]\ [LEN=%L]
"set statusline=%F%m%r%h%w%=%k\ [FORMAT=%{&ff}]\ [%{(&fenc==\"\")?&enc:&fenc}%{(&bomb?\",BOM\":\"\")}]\ [POS=%04l,%03v][%p%%]\ [LEN=%L]
set nocursorline
set nocursorcolumn
set undolevels=1000
set history=1000
set nobackup
set noswapfile
"set updatecount=1000
set sessionoptions+=unix,slash
set hlsearch
set incsearch
"set ignorecase
set noerrorbells
set pastetoggle=<F2>
nnoremap j gj
nnoremap k gk
cmap w!! w !sudo tee % >/dev/null
set modelines=10
set modeline
"Favorite filetypes
set ffs=unix,dos
nmap <leader>fd :se ff=dos<cr>
nmap <leader>fu :se ff=unix<cr>
" Hide the mouse when typing text
set mousehide
set hidden
nmap <C-H> <C-W>h
nmap <C-J> <C-W>j
nmap <C-K> <C-W>k
nmap <C-L> <C-W>l
"Quickfix
nmap <leader>cd :cn<cr>
nmap <leader>cp :cp<cr>
nmap <leader>cw :botright copen<cr>
nmap <leader>cq :cclose<cr>
nmap <leader>lq :lclose<cr>
"nmap <leader>gc :G /\<<c-r>=expand("<cword>")<cr>\>/<cr>
"nmap <leader>ga :Grep /\<<c-r>=expand("<cword>")<cr>\><cr>
nmap <leader>cb :botright cwindow<cr>
nmap <leader>qo :QFix<CR>
nmap <leader>ft :call QFixToggle(1)<CR>
command! -bang -nargs=? QFix call QFixToggle(<bang>0)
function! QFixToggle(forced)
if exists("g:qfix_win") && a:forced != 0
cclose
else
if exists("g:my_quickfix_win_height")
execute "copen ".g:my_quickfix_win_height
else
botright copen
endif
endif
endfunction
augroup QFixToggle
autocmd!
autocmd BufWinEnter quickfix let g:qfix_win = bufnr("$")
autocmd BufWinLeave * if exists("g:qfix_win") && expand("<abuf>") == g:qfix_win | unlet! g:qfix_win | endif
augroup END
function! s:Loadtags(ctags, cscope)
let s:cur_dir = getcwd()."/"
if a:ctags == 1
if filereadable(s:ProjectDir."/tags")
exec "set tags=".s:cur_dir.s:ProjectDir."/tags"
endif
endif
if a:cscope == 1
if filereadable(s:ProjectDir."/GTAGS") "设置tag文件的名字
set csprg=gtags-cscope
exec "cs add ".s:cur_dir.s:ProjectDir."/GTAGS"
elseif filereadable(s:ProjectDir."/cscope.out") "设置tag文件的名字
set csprg=cscope
exec "cs add ".s:cur_dir.s:ProjectDir."/cscope.out"
endif
endif
endfunction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" cscope setting
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has("cscope")
"set csto=1
set csto=0
set cst
"set nocsverb
"set csverb
call s:Loadtags(0, 1)
endif
"set cscopequickfix=s-!,c-!,d-!,i-!,t-!,e-!,g-!,f-!
"set cscopequickfix=s-,c-,d-,i-,t-,e-,g-,f-
"
let s:NeoCompleteEnable = 0
if !s:NeoCompleteEnable
let g:AutoCompletePopEnable = 1
nmap <leader>gs :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <leader>gg :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <leader>gc :cs find c <C-R>=expand("<cword>")<CR><CR>
"nmap <leader>gt :cs find t <C-R>=expand("<cword>")<CR><CR>
"nmap <leader>ge :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <leader>gf :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <leader>gi :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <leader>gd :cs find d <C-R>=expand("<cword>")<CR><CR>
else
let g:AutoCompletePopEnable = 0
nmap <leader>gs :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <leader>gg :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <leader>gc :cs find c <C-R>=expand("<cword>")<CR><CR>
"nmap <leader>gt :cs find t <C-R>=expand("<cword>")<CR><CR>
"nmap <leader>ge :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <leader>gf :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <leader>gi :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <leader>gd :cs find d <C-R>=expand("<cword>")<CR><CR>
endif
function! DisplayTagInLeftWin()
let s:cur_world = expand("<cword>")
"execute "wincmd L"
" Reuse or create new buffer. Based on code in Decho
" http://www.vim.org/scripts/script.php?script_id=120
"if exists("g:rrbufnr") && bufwinnr(g:rrbufnr) > 0
if exists("g:rrbufnr")
"echomsg "already has window!"
"exe "keepjumps ".bufwinnr(g:rrbufnr)."wincmd W"
exe "keepjumps ".bufwinnr('-TagResults_')." wincmd w"
"exe 'normal ggdG' "clean buffer
else
"echomsg "new window!"
"exe "keepjumps silent! vs"
exe 'keepjumps silent! vs -TagResults-'
let g:rrbufnr=bufnr('%')
end
execute "tag ".s:cur_world
endfunction
set splitright
nmap <S-F8> :call DisplayTagInLeftWin()<CR>
nmap <F7> :pop<CR>
nmap <F8> :tag <C-R>=expand("<cword>")<CR><CR>
"nmap <leader>gs :cs find s
"nmap <leader>gg :cs find g
"nmap <leader>gc :cs find c
"nmap <leader>gt :cs find t
"nmap <leader>ge :cs find e
"nmap <leader>gf :cs find f
"nmap <leader>gi :cs find i
"nmap <leader>gd :cs find d
"nmap <C-t> :colder<CR>:cc<CR>
"nmap <F3> :cclose<cr>:botright copen<cr><C-W>k
"set complete
set completeopt=longest,menuone
" set completeopt=menuone,menu,longest
"compview
let g:cvWindowPosition = 0
"Doxygen
"let g:DoxygenToolkit_briefTag_pre="@Descripton "
"let g:DoxygenToolkit_paramTag_pre="@Param "
"let g:DoxygenToolkit_returnTag="@Returns "
"let g:DoxygenToolkit_blockHeader="******************************************"
"let g:DoxygenToolkit_blockFooter="******************************************"
let g:doxygenToolkit_briefTag_funcName="yes"
let g:DoxygenToolkit_authorName="xuyufeng"
let g:DoxygenToolkit_licenseTag="ifreecomm"
"补全映射
inoremap <expr> <CR> pumvisible()?"\<C-Y>":"\<CR>"
"inoremap <expr> <SPACE> pumvisible()?"\<C-Y>":"\<SPACE>"
inoremap <expr> <C-J> pumvisible()?"\<PageDown>":"\<C-X><C-O>"
inoremap <expr> <C-K> pumvisible()?"\<PageUp>":"\<C-K>"
inoremap <expr> <C-U> pumvisible()?"\<C-E>":"\<C-U>"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Folding
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Enable folding, I find it very useful
"set fen
set fdl=9999
"nmap <silent> <leader>zo zO
"vmap <silent> <leader>zo zO
"nmap <silent> <leader>zc zC
"vmap <silent> <leader>zc zC
""设置语法折叠
"set foldmethod=syntax
"set foldcolumn=1 "设置折叠区域的宽度
"set foldclose=all "设置为自动关闭折叠
"
"" 用空格键来开关折叠
"set foldenable
"nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR>
"autocmd FileType c,cpp setl fdm=syntax | setl fen
"supertab
"let g:SuperTabRetainCompletionType = 2
let g:SuperTabDefaultCompletionType = "<C-X><C-U>"
" Buf Explorer
let g:bufExplorerDefaultHelp=0 " Do not show default help.
let g:bufExplorerShowRelativePath=1 " Show relative paths.
let g:bufExplorerSortBy='mru' " Sort by most recently used.
let g:bufExplorerSplitRight=0 " Split left.
let g:bufExplorerSplitVertical=1 " Split vertically.
let g:bufExplorerSplitVertSize = 30 " Split width
let g:bufExplorerUseCurrentWindow=1 " Open in new window.
autocmd BufEnter \[BufExplorer\] :set number
""""""""""""""""""""""""""""""
"fuzzy finder,
""""""""""""""""""""""""""""""
" let g:LookupFile_TagExpr = '"./my-project-tags/filenametags"'
let g:LookupFile_TagExpr = '"./filenametags"'
"let g:fuf_modesDisable = [ 'mrufile', 'mrucmd', 'tag', 'taggedfile']
let g:fuf_modesDisable = [ 'mrufile', 'mrucmd', 'tag' ]
let g:fuf_infoFile = ''
let g:fuf_enumeratingLimit = 30
let g:my_enumeratingLimit = 500
if 0
"nmap <F2> :AutoComplPopDisable<cr>:FufFile<cr>
nmap <leader>tt :AutoComplPopDisable<cr>:FufBufferTag<cr>
"nmap <leader>ff :AutoComplPopDisable<cr>:FufQuickfix<cr>
nmap <leader>jj :AutoComplPopDisable<cr>:FufJumpList<cr>
nmap <leader>bb :AutoComplPopDisable<cr>:FufBuffer<cr>
nmap <F5> :AutoComplPopDisable<cr>:FufTaggedFile<cr>
else
nmap <leader>tt :FufBufferTag<cr>
nmap <leader>ff :FufQuickfix<cr>
nmap <leader>jj :FufJumpList<cr>
nmap <leader>bb :FufBuffer<cr>
" nmap <F6> :FufBuffer<cr>
nmap <F5> :FufTaggedFile<cr>
endif
"command-t
nmap <leader>ct :CommandT<CR>
set wildignore+=*.o,*.obj,.git,.svn,*.a,*.obj,*.cmd,*png,*so
let g:CommandTMaxFiles=30000
""""""""""""""""""""""""""""""
" Tag list (ctags)
""""""""""""""""""""""""""""""
let Tlist_Ctags_Cmd = 'ctags'
let Tlist_Show_One_File = 1 "不同时显示多个文件的tag,只显示当前文件的
let Tlist_Exit_OnlyWindow = 1 "如果taglist窗口是最后一个窗口,则退出vim
let Tlist_Use_Right_Window = 1 "在右侧窗口中显示taglist窗口
let Tlist_WinWidth = 35
let Tlist_Display_Prototype = 0
call s:Loadtags(1, 0)
map <f10> :TlistToggle<cr>
set updatetime=100
"nmap <silent> <leader>lv :vimgrep /<c-r>=expand("<cword>")<cr>/ %<cr>:botright open<cr>
if has("win32")
"grep setting
"nnoremap <silent> <F4> :Grep<CR>
nnoremap <silent> <F4> :Rgrep<CR>
"let Grep_Default_Filelist = '*.c *.cpp *.hpp *.h *.s *.inc *.INC *.C *.S'
let Grep_Path = 'D:/cygwin/bin/grep.exe'
let Fgrep_Path = 'D:/cygwin/bin/fgrep.exe'
let Egrep_Path = 'D:/cygwin/bin/egrep.exe'
let Agrep_Path = 'D:/cygwin/bin/agrep.exe'
let Grep_Find_Path = 'D:\cygwin\bin\find.exe'
let Grep_Xargs_Path = 'D:\cygwin\bin\xargs.exe'
let Grep_Default_Options = '-i'
let Grep_Shell_Quote_Char = "'"
"let Grep_Shell_Escape_Char = '"'
endif
let Grep_Skip_Dirs = 'RCS CVS SCCS .svn .project lib obj linux_lsp linux_devkit'
let Grep_Skip_Files = '*.bak *.o *.a *.obj *.out *.oe674 *.pch *.sem3 *.oem3 *.map *.apk'
function! SaveSession()
exec "set sessionoptions-=curdir"
exec "set sessionoptions+=sesdir"
exec "mksession! ".s:ProjectDir."/project.vim"
exec "wviminfo! ".s:ProjectDir."/project.viminfo"
endfunction
function! LoadSession()
exec "source ".s:ProjectDir."/project.vim"
exec "rviminfo ".s:ProjectDir."/project.viminfo"
call s:Loadtags(1, 1)
endfunction
"session
nmap <leader>ss :call SaveSession()<cr>
" nmap <leader>ss :set sessionoptions-=curdir<cr>:set sessionoptions+=sesdir<cr>:mksession! eval(s:ProjectDir)."/project.vim"<cr>:wviminfo! eval(s:ProjectDir)."project.viminfo"<cr>
"nmap <silent> <leader>ls :source project.vim<cr>:rviminfo project.viminfo<cr>:cs add cscope.out<cr>:set tags=tags<cr>:let g:LookupFile_TagExpr = '"./filenametags"'<cr>:source $VIMRUNTIME/../vimfiles/plugin/mark.vim<cr>
"nmap <leader>ls :source project.vim<cr>:rviminfo project.viminfo<cr>:cs add cscope.out<cr>:set tags=tags<cr>:let g:LookupFile_TagExpr = '"./filenametags"'<cr>:source $HOME/.vim/bundle/mark/plugin/mark.vim<cr>
nmap <leader>ls :call LoadSession()<cr>
"nmap <leader>sp :set paste<cr>
"nmap <leader>np :set nopaste<cr>
if has("win32")
map <silent> <leader>s :source $HOME/_vimrc<cr>
map <silent> <leader>e :e $HOME/_vimrc<cr>
else
"Fast reloading of the _vimrc
map <silent> <leader>s :source $HOME/.vimrc<cr>
"Fast editing of _vimrc
map <silent> <leader>e :e $HOME/.vimrc<cr>
endif
if has("win32")
autocmd! bufwritepost .vimrc source $HOME/_vimrc
else
"When vimrc is edited, reload it
autocmd! bufwritepost .vimrc source $HOME/.vimrc
endif
map <C-n> :cn<CR>
map <C-p> :cp<CR>
map <leader>bd :Bclose<cr>
"map <leader>bd :bd<cr>
vnoremap <leader>y "+y
nmap <leader>yw "+yw
nmap <leader>p "+p
"yankring
nnoremap <silent> <leader>ys :YRShow<CR>
"
function! UpdateDateTags()
if filereadable(s:ProjectDir."/tags")
" exec ":silent !ctags -L ".s:ProjectDir."/cscope.files -f ".s:ProjectDir."/tags"
exec ":silent !ctags -L ".s:ProjectDir."/cscope.files -f ".s:ProjectDir."/tags"
exec ":silent !ctags --c++-kinds=+p --fields=+iaS --extra=+q -L ".s:ProjectDir."/cscope.files -f ".s:ProjectDir."/tags"
exec ":redraw!"
endif
if filereadable(s:ProjectDir."/GTAGS")
echomsg "update gtags"
exec ":silent !gtags -f ".s:ProjectDir."/cscope.files -i ".s:ProjectDir
exec ':silent cs reset'
exec ":redraw!"
elseif filereadable(s:ProjectDir."/cscope.out")
echomsg "update cscope"
exec ":silent !mv ".s:ProjectDir."/cscope.* ./"
exec ":silent !cscope -bkq -i cscope.files"
echomsg "!mv cscope.* ".s:ProjectDir
exec ":redraw!"
exec ":silent !mv cscope.* ".s:ProjectDir
exec ':silent cs reset'
exec ":redraw!"
endif
endfunction
nmap <F9> :call UpdateDateTags()<CR>
"nmap <F9> :!cscope -bkq -i cscope.files -f cscope.out<CR>:cs reset<CR>
"nmap <F9> :!gtags -f cscope.files -i<CR>:cs reset<CR>
" Don't close window, when deleting a buffer
command! Bclose call <SID>BufcloseCloseIt()
function! <SID>BufcloseCloseIt()
let l:currentBufNum = bufnr("%")
let l:alternateBufNum = bufnr("#")
if buflisted(l:alternateBufNum)
buffer #
else
bnext
endif
if bufnr("%") == l:currentBufNum
new
endif
if buflisted(l:currentBufNum)
execute("bdelete! ".l:currentBufNum)
endif
endfunction
"Mark
nmap <Leader>M <Plug>MarkToggle
nmap <Leader><SPACE> <Plug>MarkAllClear
""""""""""""""""""""""""""""""
" markbrowser setting
""""""""""""""""""""""""""""""
"nmap <silent> <leader>mk :MarksBrowser<cr>
"
""""""""""""""""""""""""""""""
" showmarks setting
""""""""""""""""""""""""""""""
" Enable ShowMarks
let showmarks_enable = 1
" Show which marks
let showmarks_include = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
" Ignore help, quickfix, non-modifiable buffers
let showmarks_ignore_type = "hqm"
" Hilight lower & upper marks
let showmarks_hlline_lower = 1
let showmarks_hlline_upper = 1
" let g:LookupFile_DisableDefaultMap = 1
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplcache.
let g:neocomplcache_enable_at_startup = 1
" Use smartcase.
let g:neocomplcache_enable_smart_case = 1
" Set minimum syntax keyword length.
let g:neocomplcache_min_syntax_length = 3
let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
" Enable heavy features.
" Use camel case completion.
"let g:neocomplcache_enable_camel_case_completion = 1
" Use underbar completion.
"let g:neocomplcache_enable_underbar_completion = 1
" Define dictionary.
let g:neocomplcache_dictionary_filetype_lists = {
\ 'default' : '',
\ }
" Define keyword.
if !exists('g:neocomplcache_keyword_patterns')
let g:neocomplcache_keyword_patterns = {}
endif
let g:neocomplcache_keyword_patterns['default'] = '\h\w*'
" Plugin key-mappings.
inoremap <expr><C-g> neocomplcache#undo_completion()
inoremap <expr><C-l> neocomplcache#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 neocomplcache#smart_close_popup() . "\<CR>"
" For no inserting <CR> key.
return pumvisible() ? neocomplcache#close_popup() : "\<CR>"
endfunction
" <TAB>: completion.
" inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<S-TAB>"
" <C-h>, <BS>: close popup and delete backword char.
inoremap <expr><C-h> neocomplcache#smart_close_popup()."\<C-h>"
inoremap <expr><BS> neocomplcache#smart_close_popup()."\<C-h>"
" inoremap <expr><C-y> neocomplcache#close_popup()
inoremap <expr><C-e> neocomplcache#cancel_popup()
inoremap <expr><CR> pumvisible() ? neocomplcache#close_popup() : "\<CR>"
" For cursor moving in insert mode(Not recommended)
"inoremap <expr><Left> neocomplcache#close_popup() . "\<Left>"
"inoremap <expr><Right> neocomplcache#close_popup() . "\<Right>"
"inoremap <expr><Up> neocomplcache#close_popup() . "\<Up>"
"inoremap <expr><Down> neocomplcache#close_popup() . "\<Down>"
" Or set this.
"let g:neocomplcache_enable_cursor_hold_i = 1
" Or set this.
"let g:neocomplcache_enable_insert_char_pre = 1
" AutoComplPop like behavior.
let g:neocomplcache_enable_auto_select = 1
" Shell like behavior(not recommended).
"set completeopt+=longest
"let g:neocomplcache_enable_auto_select = 1
"let g:neocomplcache_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
" Enable heavy omni completion.
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*::'
" For perlomni.vim setting.
" https://github.com/c9s/perlomni.vim
" let g:neocomplcache_omni_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
" SuperTab like snippets behavior.
"imap <expr><TAB> neosnippet#expandable_or_jumpable() ?
"\ "\<Plug>(neosnippet_expand_or_jump)"
"\: pumvisible() ? "\<C-n>" : "\<TAB>"
"smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
"\ "\<Plug>(neosnippet_expand_or_jump)"
"\: "\<TAB>"
"
"" For snippet_complete marker.
"if has('conceal')
" set conceallevel=2 concealcursor=i
"endif
let g:neocomplcache_force_overwrite_completefunc=1
let g:clang_complete_auto=1 "don't auto do clang_complete
let g:clang_hl_errors = 0
if !filereadable(s:ProjectDir."/project-setting.vim") "工程配置文件的名字
let g:clang_use_library = 1 "applications
endif
let g:clang_library_path = '/usr/lib/llvm'
" let g:clang_library_path = '/usr/local/lib'
let g:clang_complete_copen = 1
let g:clang_complete_macros = 0
let g:clang_complete_patterns = 0
let g:clang_sort_algo = ''
let g:clang_auto_select = 1
let g:clang_auto_user_options = '.clang_complete'
nmap <silent> <leader>Q :call g:ClangUpdateQuickFix()<cr>
nmap <silent> <leader>C :let g:clang_complete_auto=!g:clang_complete_auto<cr>
augroup filetypedetect
au BufNewFile,BufRead *.bld setf javascript
augroup END
augroup filetypedetect
au BufNewFile,BufRead *.make setf make
augroup END
"let g:clang_user_options = '|| exit 0"'
"if has("win32")
"let g:clang_user_options = '2> NUL || exit 0"'
"else
"let g:clang_user_options = '2> /dev/null || exit 0"'
"endif
" let g:NERDCompactSexyComs = 1
let g:NERDSpaceDelims = 1
let g:rainbow_active = 1
" rainbow_parentheses
"au VimEnter * RainbowParenthesesToggle
"au Syntax * RainbowParenthesesLoadRound
"au Syntax * RainbowParenthesesLoadSquare
"au Syntax * RainbowParenthesesLoadBraces
map <Leader>fa <Plug>AM_afnc
map <Leader>dc <Plug>AM_adec
map <Leader>df <Plug>AM_adef