-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.vimrc
executable file
·842 lines (752 loc) · 24.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
if has ("win32")
let $HOME=$VIMRUNTIME.'/../'
"let g:tagbar_ctags_bin=$HOME.'/vim/ctags.exe'
let g:neocomplcache_ctags_program=$VIMRUNTIME.'/ctags.exe'
let g:tagbar_systemenc = 'GBK'
endif
"设置neobundle
set nocompatible " be iMproved
if has ("win32")
if has('vim_starting')
set runtimepath+=$HOME/vimfiles/bundle/neobundle.vim/
endif
call neobundle#begin(expand('$HOME/vimfiles/bundle/'))
let $CONFIG_DIR=$HOME.'/vimfiles/'
else
if has('vim_starting')
set runtimepath+=$HOME/.vim/bundle/neobundle.vim/
endif
call neobundle#begin(expand('$HOME/.vim/bundle/'))
let $CONFIG_DIR=$HOME.'/.vim/'
set mouse-=a
endif
" Let NeoBundle manage NeoBundle
NeoBundleFetch 'Shougo/neobundle.vim'
" Recommended to instal
" After install, turn shell ~/.vim/bundle/vimproc, (n,g)make -f your_machines_makefile
NeoBundle 'Shougo/vimproc'
" My Bundles here:
" original repos on github
NeoBundle 'a.vim'
"NeoBundle 'BlockComment.vim'
NeoBundle 'bufexplorer.zip'
NeoBundle 'c.vim'
NeoBundle "octol/vim-cpp-enhanced-highlight"
"NeoBundle 'comments.vim'
NeoBundle 'genutils'
NeoBundle 'grep.vim'
NeoBundle 'mileszs/ack.vim'
"NeoBundle 'lookupfile'
"NeoBundle 'SuperTab'
NeoBundle 'DrawIt'
NeoBundle 'taglist.vim'
NeoBundle 'TxtBrowser'
"NeoBundle 'Visual-Mark'
NeoBundle 'pythoncomplete'
"NeoBundle 'rkulla/pydiction'
NeoBundle 'unite.vim'
NeoBundle 'FencView.vim'
NeoBundle 'LargeFile'
"NeoBundle 'std_c.zip' " c highlight plugin
"NeoBundle 'after/syntax/c.vim'
NeoBundle 'highlight.vim'
"NeoBundle 'QFixToggle' " jump visiable window for quickfix
NeoBundle 'cmdline-completion' " command auto-complete use c-p and c-n
NeoBundle 'morhetz/gruvbox'
NeoBundle 'brookhong/cscope.vim'
NeoBundle 'kien/ctrlp.vim'
NeoBundle 'mbbill/echofunc'
NeoBundle 'adah1972/tellenc'
"NeoBundle 'Shougo/neocomplcache'
NeoBundle 'Shougo/vimshell.vim'
NeoBundle 'plasticboy/vim-markdown'
NeoBundle 'octol/vim-cpp-enhanced-highlight'
NeoBundle 'ntpeters/vim-better-whitespace'
NeoBundle 't9md/vim-quickhl'
"complete plugins
"NeoBundle 'Shougo/neocomplete.vim'
"NeoBundle 'Shougo/neosnippet.vim'
NeoBundle 'Valloric/YouCompleteMe', {
\ 'build' : {
\ 'mac' : './install.py',
\ 'unix' : './install.py',
\ 'windows' : 'install.py',
\ 'cygwin' : './install.py'
\ }
\ }
NeoBundle 'SirVer/ultisnips'
NeoBundle 'honza/vim-snippets'
NeoBundle 'scrooloose/nerdtree'
NeoBundle 'majutsushi/tagbar'
"NeoBundle 'honza/snipmate-snippets'
NeoBundle 'magic-dot-files/TagHighlight' "tag highlight plugin
NeoBundle 'altercation/vim-colors-solarized' "colorscheme
NeoBundle 'tomasr/molokai' "colorscheme
NeoBundle 'rking/ag.vim' "ag search
NeoBundle 'scrooloose/syntastic' "syntax checking plugin
NeoBundle 'godlygeek/tabular' "align text
NeoBundle 'tpope/vim-endwise' "complete certain structures automatically
NeoBundle 'Raimondi/delimitMate' "automatic closing of quotes, parenthesis, brackets, etc.
NeoBundle 'scrooloose/nerdcommenter' "comments
" ctrlp extensions
NeoBundle 'tacahiroy/ctrlp-funky' "function finding
NeoBundle 'sgur/ctrlp-extensions.vim' "cmdline, yankring, menu history
NeoBundle 'acx0/Conque-Shell' " shell
NeoBundle 'Lokaltog/vim-easymotion' " search and jump
NeoBundle 'skydark/fcitx.vim' " linux fcitx
NeoBundle 'PFZheng/Visual-Mark' " fix for Linux Chinese
NeoBundle 'PFZheng/vim-colorscheme'
NeoBundle 'Shougo/vimfiler' " file explorer
"NeoBundle 'nathanaelkane/vim-indent-guides' " indent guide
NeoBundle 'Yggdroot/indentLine' " indent guide
NeoBundle 'sjl/gundo.vim' " gundo
NeoBundle 'michalliu/jsruntime.vim' " js runtime
NeoBundle 'michalliu/jsoncodecs.vim' " json
NeoBundle 'elzr/vim-json' " json synatic
NeoBundle 'michalliu/sourcebeautify.vim' " html source beautify
NeoBundle 'tpope/vim-surround'
NeoBundle "mattn/emmet-vim"
NeoBundle 'maksimr/vim-jsbeautify'
NeoBundle 'einars/js-beautify'
"NeoBundle 'ctrlsf.vim'
NeoBundle 'hail2u/vim-css3-syntax' " CSS syntax
NeoBundle 'othree/html5.vim' " HTML5 syntax
NeoBundle 'pangloss/vim-javascript' " js syntax
"NeoBundle 'jistr/vim-nerdtree-tabs'
NeoBundle 'tpope/vim-markdown'
NeoBundle 'kshenoy/vim-signature'
"php bundles
"NeoBundle 'StanAngeloff/php.vim'
"NeoBundle 'joonty/vdebug'
"NeoBundle 'shawncplus/phpcomplete.vim'
" some plugins only use in gui
"if has("gui_running")
NeoBundle 'minibufexpl.vim'
"NeoBundle 'Lokaltog/vim-powerline'
NeoBundle 'bling/vim-airline'
"endif
if has("mac")
NeoBundle 'msanders/cocoa.vim'
NeoBundle 'rizzatti/dash.vim'
endif
call neobundle#end()
filetype plugin indent on " required!
" Installation check.
NeoBundleCheck
"Persistent undo
let $undo_dir = $HOME.'/.vimundo'
if finddir($undo_dir) == ''
silent call mkdir($undo_dir)
endif
set undodir=$HOME/.vimundo
set undofile
"set nocompatibl
set nu
set magic
set ru "标尺信息
set cc=81 "vim 7.3新功能,高亮列
set et " expandtab,用空格代替Tab键
set showcmd
set ai
set sw=4
set ts=4
set sm
set dy=lastline "显示最多行,不用@@
"以上是缩进相关
set backspace=indent,eol,start
sy on
set nobackup
" Search
set ignorecase
set incsearch
set hlsearch
"Don't update while in macro
set lazyredraw
" No sound on errors.
set noerrorbells
set novisualbell
set t_vb=
" Show matching bracet
set showmatch
" In Visual Block Mode, cursor can be positioned where there is no actual character
set ve=block
" enable omni completion
filetype plugin on
set ofu=syntaxcomplete#Complete
syntax enable
syntax on
set cursorline " highlight current line
set t_Co=256
" fix chinese ime bug in mac
"set noimd
set imsearch=0
" ui
" set default guifont
if has("gui_running")
" check and determine the gui font after GUIEnter.
" NOTE: getfontname function only works after GUIEnter.
winpos 200 100
if has("gui_macvim")
set lines=40 columns=90
else
set lines=35 columns=75
endif
au GUIEnter * call s:SetGuiFont()
endif
" set guifont
function s:SetGuiFont()
if has("gui_gtk2")
if getfontname( "Powerline\ Consolas" ) != ""
let font_name = "Powerline\ Consolas"
elseif getfontname( "Consolas" ) != ""
let font_name = "Consolas"
elseif getfontname( "Droid Sans Mono" ) != ""
set guifont=Droid\ Sans\ Mono\ 11
else
set guifont=Monospace\ 11
endif
elseif has("x11")
" Also for GTK 1
set guifont=*-lucidatypewriter-medium-r-normal-*-*-180-*-*-m-*-*
elseif has("gui_macvim")
if getfontname( "Monaco" ) != ""
set guifont=Monaco:h12
elseif getfontname( "Consolas" ) != ""
set guifont=Consolas:h12
endif
elseif has("gui_win32")
let font_name = ""
" for powerline in windows
if getfontname( "Powerline\ Consolas" ) != ""
set guifont=Powerline\ Consolas:h11:cANSI
let font_name = "Powerline\ Consolas"
elseif getfontname( "Consolas" ) != ""
set guifont=Consolas:h11:cANSI " this is the default visual studio font
let font_name = "Consolas"
elseif getfontname( "Bitstream_Vera_Sans_Mono" ) != ""
set guifont=Bitstream_Vera_Sans_Mono:h11:cANSI
let font_name = "Bitstream_Vera_Sans_Mono"
else
set guifont=Lucida_Console:h11:cANSI
let font_name = "Lucida_Console"
endif
silent exec "nnoremap <unique> <M-F1> :set guifont=".font_name.":h11:cANSI<CR>"
endif
endfunction
" color scheme define
"" let g:colorscheme_name = "molokai"
"let g:colorscheme_name = "solarized"
"let theme_bg = "light"
"" let theme_bg = "dark"
"if g:colorscheme_name == "solarized"
"let g:airline_theme = 'solarized'
"else
"let g:airline_theme = 'molokai'
"let theme_bg = "dark"
"endif
"let g:airline_theme = 'bubblegum'
"let g:colorscheme_name = "Tomorrow-Night"
let g:colorscheme_name = "gruvbox"
let g:airline_theme = 'gruvbox'
exec "colorscheme ".g:colorscheme_name
"exec "set background=".theme_bg
let g:gruvbox_invert_indent_guides = 1
" save views
au BufWinLeave *.ztx mkview
au BufWinEnter *.ztx silent loadview
au BufNewFile,BufRead *.tx1 setf tx1
" encoding
set encoding=utf-8
set termencoding=utf-8
set fileencodings=utf-8,gbk,cp936,gb18030,big5,euc-jp,euc-kr,latin1
if has("win32")
set fileencoding=utf-8
else
set fileencoding=utf-8
endif
" hide menu and toolbar
if(has("gui_running"))
"处理菜单及右键菜单乱码
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
source $VIMRUNTIME/mswin.vim
set guioptions-=m
set guioptions-=T
map <silent> <F9> :if &go=~#'m'<Bar>set go-=m<Bar>set go-=T<Bar>else<Bar>set go+=m<Bar>set go+=T<Bar>endif<CR>
" Use CTRL-S for saving, also in Insert mode
"noremap <C-S> :update<CR>
"vnoremap <C-S> :update<CR>
"inoremap <C-S> <C-O>:update<CR>
"复制粘贴快捷键
"noremap <C-A> 1GvG$
"vnoremap <C-A> 1GvG$
"inoremap <C-A> <ESC>1GvG$
"noremap <C-C> "+y
"vnoremap <C-C> "+y
"inoremap <C-C> <ESC>"+y<ESC>
"noremap <C-V> "+P
"vnoremap <C-V> "+P
"inoremap <C-V> <ESC>"+Pi
"
"从ms.vim里粘贴出的快捷键定义
" vnoremap <C-X> "+x
"vnoremap <C-C> "+y
"map <C-V> "+gP
"cmap <C-V> "+gP
"exe 'inoremap <script> <C-V>' paste#paste_cmd['i']
"exe 'vnoremap <script> <C-V>' paste#paste_cmd['v']
"noremap <C-S> :update<CR>
"vnoremap <C-S> <C-C>:update<CR>
"inoremap <C-S> <C-O>:update<CR>
"noremap <C-A> gggH<C-O>G<C-O>
"inoremap <C-A> <C-O>gg<C-O>gH<C-O>G<C-O>
"cnoremap <C-A> <C-C>gggH<C-O>G<C-O>
"onoremap <C-A> <C-C>gggH<C-O>G<C-O>
"snoremap <C-A> <C-C>gggH<C-O>G<C-O>
"xnoremap <C-A> <C-C>ggVG<C-O>
source $VIMRUNTIME/mswin.vim
"处理consle输出乱码
language messages zh_CN.utf-8
endif
""-----plugin configs------
" ag.vim
if executable('ag')
let g:ag_prg = 'ag --vimgrep --smart-case -t'
let g:ag_working_path_mode='r'
let g:ag_highlight=1
else
endif
" NERDTree
map <F10> :NERDTreeToggle<CR>
imap <F10> <ESC>:NERDTreeToggle<CR>
" 用空格键来开关折叠(说明西方“"”后面的内容为注释,不会被VIM所识别)
"set foldenable
"set foldmethod=indent
"nnoremap <F4> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR>
"Latex
" REQUIRED. This makes vim invoke Latex-Suite when you open a tex file.
"filetype plugin on
" IMPORTANT: win32 users will need to have 'shellslash' set so that latex
" can be called correctly.
set shellslash
" OPTIONAL: 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'
" IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a singe file. This will confuse Latex-Suite. Set your grep
" program to always generate a file-name.
set grepprg=grep\ -nH\ $*
"ctags
"set autochdir
set tags=./tags,tags;
"taglist
let Tlist_Show_One_File = 1 " Displaying tags for only one file~
let Tlist_Exist_OnlyWindow = 1 " if you are the last, kill yourself
"let Tlist_Use_Right_Window = 1 " split to the right side of the screen
let Tlist_Sort_Type = "order" " sort by order or name
let Tlist_Display_Prototype = 0 " do not show prototypes and not tags in the taglist window.
let Tlist_Compart_Format = 1 " Remove extra information and blank lines from the taglist window.
"let Tlist_GainFocus_On_ToggleOpen = 1 " Jump to taglist window on open.
let Tlist_Display_Tag_Scope = 1 " Show tag scope next to the tag name.
"let Tlist_Close_On_Select = 0 " Close the taglist window when a file or tag is selected.
"let Tlist_BackToEditBuffer = 0 " If no close on select, let the user choose back to edit buffer or not
let Tlist_Enable_Fold_Column = 0 " Don't Show the fold indicator column in the taglist window.
let Tlist_WinWidth = 30
let Tlist_Compact_Format = 1 " do not show help
let g:winManagerWindowLayout='FileExplorer'
"let g:winManagerWindowLayout='FileExplorer|TagList'
let g:winManagerWidth = 30
nmap wm :WMToggle<cr>
nnoremap <unique> <silent> <F4> :WMToggle<cr>
"let Tlist_WinWidth=50
"au VimEnter * call feedkeys("wm")
"c/h文件切换插件
"nnoremap <silent> <F12> :A<CR>
"grep
"nnoremap <silent> <F3> :Grep<CR>
"cscope
":set cscopequickfix=s-,c-,d-,i-,t-,e-
"QuickFix
"nmap <F6> :cn<cr>
"nmap <F7> :cp<cr>
"补齐
set completeopt=longest,menu
"cscope代码文件夹
"if has("cscope")
" add any database in current directory
"set nocsverb
"if filereadable("cscope.out")
"cs add cscope.out
"elseif filereadable("../cscope.out")
"cs add ../cscope.out
"elseif filereadable("../../cscope.out")
"cs add ../../cscope.out
"elseif filereadable("../../../cscope.out")
"cs add ../../../cscope.out
"elseif filereadable("../../../../cscope.out")
"cs add ../../../../cscope.out
"endif
"set csverb
"set csto=0
"endif
" delimitMate
" let delimitMate_autoclose = 0
let delimitMate_matchpairs = "(:),[:],{:},<:>"
let delimitMate_quotes = "\" ' `"
let delimitMate_excluded_regions = "Comment,String" "This options turns delimitMate off for the listed regions
" let delimitMate_excluded_ft = "mail,txt" "turn off delimitMate for specific files
"txtBrowser
let tlist_txt_settings = 'txt;c:content;f:figures;t:tables'
au BufRead,BufNewFile *.txt setlocal ft=txt
au BufRead,BufNewFile *.log setlocal ft=txt
" lookupfile setting
"let g:LookupFile_MinPatLength = 2 "最少输入2个字符才开始查找
"let g:LookupFile_PreserveLastPattern = 0 "不保存上次查找的字符串
"let g:LookupFile_PreservePatternHistory = 1 "保存查找历史
"let g:LookupFile_AlwaysAcceptFirst = 1 "回车打开第一个匹配项目
"let g:LookupFile_AllowNewFiles = 0 "不允许创建不存在的文件
""映射LookupFile为,lk
"nmap <silent> lk :LUTags<cr>
""映射LUBufs为,ll
"nmap <silent> ll :LUBufs<cr>
""映射LUWalk为,lw
"nmap <silent> lw :LUWalk<cr>
" NeoComplete
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplete.
let g:neocomplete#enable_at_startup = 0
" Disable auto complete
let g:neocomplete#disable_auto_complete = 1
" Use smartcase.
let g:neocomplete#enable_smart_case = 0
" Set minimum syntax keyword length.
let g:neocomplete#sources#syntax#min_keyword_length = 3
let g:neocomplete#manual_completion_start_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 neocomplete#close_popup() . "\<CR>"
"" For no inserting <CR> key.
""return pumvisible() ? neocomplete#close_popup() : "\<CR>"
"endfunction
"" <TAB>: completion.
"inoremap <expr><TAB> pumvisible() ? "\<C-n>" :
" \ <SID>check_back_space() ? "\<TAB>" :
" \ neocomplete#start_manual_complete()
"function! s:check_back_space() "{{{
" let col = col('.') - 1
" return !col || getline('.')[col - 1] =~ '\s'
"endfunction "}}}
"" <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>"
"inoremap <expr><C-y> neocomplete#close_popup()
"inoremap <expr><C-e> neocomplete#cancel_popup()
"" Close popup by <Space>.
""inoremap <expr><Space> pumvisible() ? neocomplete#close_popup() : "\<Space>"
" For cursor moving in insert mode(Not recommended)
"inoremap <expr><Left> neocomplete#close_popup() . "\<Left>"
"inoremap <expr><Right> neocomplete#close_popup() . "\<Right>"
"inoremap <expr><Up> neocomplete#close_popup() . "\<Up>"
"inoremap <expr><Down> neocomplete#close_popup() . "\<Down>"
" Or set this.
"let g:neocomplete#enable_cursor_hold_i = 1
" Or set this.
"let g:neocomplete#enable_insert_char_pre = 1
" 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
" 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*::'
" tagbar
let g:tagbar_right = 1
let g:tagbar_width = 35
let g:tagbar_autoclose = 0
let g:tagbar_autofocus = 0
let g:tagbar_singleclick = 0
nmap <F8> :TagbarToggle<CR>
" split buffer windows
nmap ws :split<cr>
nmap wv :vsplit<cr>
nmap wq :close<cr>
" move between windows with Alt+arrows
nmap <silent> <A-Up> :wincmd k<CR>
nmap <silent> <A-Down> :wincmd j<CR>
nmap <silent> <A-Left> :wincmd h<CR>
nmap <silent> <A-Right> :wincmd l<CR>
" move between windows with wh, wj, wk, wl
nmap wk :wincmd k<CR>
nmap wj :wincmd j<CR>
nmap wh :wincmd h<CR>
nmap wl :wincmd l<CR>
" powerline
"set laststatus=2
"set t_Co=256
""let g:Powerline_symbols = 'unicode'
"let g:Powerline_dividers_override = ['', '>', '', '<']
"let g:Powerline_symbols_override = {
"\ 'BRANCH': '⭠',
"\ 'LINE': '⭡',
"\ 'RO' : '⭤',
"\ }
"let g:Powerline_mode_V = 'V·LINE'
"let g:Powerline_mode_cv = 'V·BLOCK'
"let g:Powerline_mode_S = 'S·LINE'
"let g:Powerline_mode_cs = 'S·BLOCK'
"" vim-airline
set laststatus=2
"let g:airline_theme = 'solarized'
let g:airline_enable_branch = 1
let g:airline_enable_syntastic = 1
"let g:airline_powerline_fonts = 1
" vim-powerline like symbols
"let g:airline_left_sep = '>'
"let g:airline_right_sep = '<'
if has("mac")
let g:airline_branch_prefix = '¶'
let g:airline_readonly_symbol = 'R'
let g:airline_linecolumn_prefix = ''
let g:airline_left_sep = '»'
let g:airline_left_sep = '▶'
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'
else
let g:airline_branch_prefix = 'B'
let g:airline_readonly_symbol = 'R'
let g:airline_linecolumn_prefix = 'LN'
let g:airline_left_sep = '>'
let g:airline_left_sep = '>'
let g:airline_right_sep = '<'
let g:airline_right_sep = '<'
endif
"let g:airline_symbols.linenr = '␊'
"let g:airline_symbols.linenr = ''
"let g:airline_symbols.linenr = '¶'
"let g:airline_symbols.branch = '⎇'
"let g:airline_symbols.paste = 'ρ'
"let g:airline_symbols.paste = 'Þ'
"let g:airline_symbols.paste = '∥'
"let g:airline_symbols.whitespace = 'Ξ'
"let g:airline_mode_map = {
"\ '__' : '',
"\ }
"let g:airline#extensions#tabline#enabled = 1
let g:airline_exclude_filenames = ['-MiniBufExplorer-','__Tagbar__']
let g:airline#extensions#tagbar#enabled = 0
let g:airline#extensions#default#layout = [
\ [ 'a', 'b', 'c' ],
\ [ 'x', 'y', 'z']
\ ]
"MiniBufExplorer
let g:miniBufExplorerMoreThanOne = 0
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
"std_c
"let c_c_vim_compatible = 1
"let c_C99 = 1
"let c_ansi_typedefs = 1
"let c_ansi_constants = 1
"let c_posix = 1
"let c_math = 1
"let c_gnu = 1
"let c_comment_types = 1
"let c_syntax_for_h = 1
" open vimgrep, search in current file, and store in quickfix windows
map ,r :vimgrep /\<<c-r><c-w>\>/j
map ,R "ay:vimgrep /\<<c-r>a\>/j
let Grep_Skip_Files = '*.bak *.swp tags'
function! QFixToggle(force)
if exists("g:qfix_win")
cclose
unlet g:qfix_win
else
copen 10
let g:qfix_win = bufnr("$")
endif
endfunction
" toggle for quickfix
nmap <silent> <F4> :call QFixToggle(0)<CR>
"NERDCommenter
vmap <leader>b <plug>NERDCommenterNested
nmap <leader>b <plug>NERDCommenterNested
"imap <c-b> <ESC><c-b>i
vmap <leader>u <plug>NERDCommenterUncomment
nmap <leader>u <plug>NERDCommenterUncomment
"imap <c-u> <ESC><c-u>i
" CtrlP
" let g:ctrlp_map = '<c-p>'
" let g:ctrlp_cmd = 'CtrlP'
" searching by filename, use <c-d> to switch between filename and full path
" let g:ctrlp_by_filename = 1
" user defined root markers
let g:ctrlp_match_window = 'bottom,order:ttb,min:1,max:15,results:100'
" let g:ctrlp_root_markers = ['.ctrlp', '.git', '.svn', '.hg', '.bzr',
" \ '_darcs', '_svn', 'README']
let g:ctrlp_root_markers = ['.ctrlp']
let g:ctrlp_open_new_file = 'r'
let g:ctrlp_regexp = 1
" follow symbol links
let g:ctrlp_follow_symlinks = 1
let g:ctrlp_extensions = ['funky','cmdline','menu']
let g:ctrlp_max_files = 100000
" keymap
nnoremap <Space>p :CtrlP<Cr>
nnoremap <Space>e :CtrlPBuffer<Cr>
nnoremap <Space>] :CtrlPTag<Cr>
nnoremap <Space>t :CtrlPBufTagAll<Cr>
nnoremap <Space>T :CtrlPBufTag<Cr>
nnoremap <Space>q :CtrlPQuickfix<Cr>
nnoremap <Space>d :CtrlPDir<Cr>
nnoremap <Space>r :CtrlPRTS<Cr>
nnoremap <Space>u :CtrlPUndo<Cr>
nnoremap <Space>l :CtrlPLine<Cr>
nnoremap <Space>c :CtrlPChange<Cr>
nnoremap <Space>C :CtrlPChangeAll<Cr>
nnoremap <Space>m :CtrlPMixed<Cr>
nnoremap <Space>b :CtrlPBookmarkDir<Cr>
nnoremap <Space>B :CtrlPBookmarkDirAdd<Cr>
nnoremap <Space>f :CtrlPFunky<Cr>
nnoremap <Space>F :execute 'CtrlPFunky '.expand('<cword>')<Cr>
" VimFiler
let g:vimfiler_as_default_explorer = 1
" syntastic
let g:syntastic_mode_map = { 'mode': 'passive',
\ 'active_filetypes': ['python', 'ruby', 'php'],
\ 'passive_filetypes': ['cpp', 'java'] }
" indent guides
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_guide_size = 1
let g:indent_guides_start_level = 2
let g:indent_guides_exclude_filetypes = ['help', 'nerdtree', 'tagbar']
" pydict
" let g:pydiction_location = $CONFIG_DIR.'/bundle/Pydiction/complete-dict'
" largefile
let g:LargeFile = 30
" gundo
nnoremap <F6> :GundoToggle<CR>
"let g:gundo_width = 60
"let g:gundo_preview_height = 40
let g:gundo_right = 1
" js beautifier
map <c-l> :call JsBeautify()<cr>
" or
autocmd FileType javascript noremap <buffer> <c-l> :call JsBeautify()<cr>
" for html
autocmd FileType html noremap <buffer> <c-l> :call HtmlBeautify()<cr>
" for css or scss
autocmd FileType css noremap <buffer> <c-l> :call CSSBeautify()<cr>
" tagbar
if (has("mac"))
let g:tagbar_type_objc = {
\ 'ctagstype': 'objc',
\ 'ctagsargs': [
\ '-f',
\ '-',
\ '--excmd=pattern',
\ '--extra=',
\ '--format=2',
\ '--fields=nksaSmt',
\ '--options=' . expand('~/.objctags'),
\ '--objc-kinds=-N',
\ ],
\ 'sro': ' ',
\ 'kinds': [
\ 'c:constant',
\ 'e:enum',
\ 't:typedef',
\ 'i:interface',
\ 'P:protocol',
\ 'p:property',
\ 'I:implementation',
\ 'M:method',
\ 'g:pragma',
\ ],
\ }
endif
" PHP.vim
"let g:php_syntax_extensions_enabled = 1
"let b:php_syntax_extensions_enabled = 1
"function! PhpSyntaxOverride()
"hi! def link phpDocTags phpDefine
"hi! def link phpDocParam phpType
"endfunction
"augroup phpSyntaxOverride
"autocmd!
"autocmd FileType php call PhpSyntaxOverride()
"augroup END
"vdebug
let g:vdebug_options= {
\ "port" : 9001,
\ "server" : 'localhost',
\ "timeout" : 20,
\ "on_close" : 'detach',
\ "break_on_open" : 1,
\ "ide_key" : 'php-xdebug',
\ "path_maps" : {},
\ "debug_window_level" : 0,
\ "debug_file_level" : 0,
\ "debug_file" : "",
\ "watch_window_style" : 'expanded',
\ "marker_default" : '⬦',
\ "marker_closed_tree" : '▸',
\ "marker_open_tree" : '▾'
\}
"ultisnips
let g:UltiSnipsEditSplit="vertical"
"YouCompleteMe
let g:ycm_global_ycm_extra_conf=$CONFIG_DIR.'/bundle/YouCompleteMe/third_party/ycmd/examples/.ycm_extra_conf.py'
let g:ycm_seed_identifiers_with_syntax=1
let g:ycm_complete_in_comments = 0
let g:ycm_show_diagnostics_ui = 0
" Visual-Mark
map <unique> <F5> <Plug>Vm_goto_next_sign
map <unique> <s-F5> <Plug>Vm_goto_prev_sign
" markdown
autocmd BufNewFile,BufReadPost *.md set filetype=markdown
" virsual arrow map
"vmap <UP> k
"vmap <LEFT> h
"vmap <RIGHT> l
"vmap <DOWN> j
nmap <Space>m <Plug>(quickhl-manual-this)
xmap <Space>m <Plug>(quickhl-manual-this)
nmap <Space>M <Plug>(quickhl-manual-reset)
xmap <Space>M <Plug>(quickhl-manual-reset)