-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathneil_vimrc
891 lines (785 loc) · 31.1 KB
/
neil_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
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <[email protected]>
" Last change: 2011 Apr 15
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
" for OpenVMS: sys$login:.vimrc
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
finish
endif
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
filetype off " required
"--------------- Add Vundle Plugin-------------------
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
" In your .vimrc.before.local file
" list only the plugin groups you will use
if !exists('g:spf13_bundle_groups')
let g:spf13_bundle_groups=['general', 'writing', 'neocomplete', 'programming', 'php', 'ruby', 'python', 'javascript', 'html', 'misc',]
endif
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
" Plugin 'tpope/vim-fugitive'
Plugin 'VundleVim/Vundle.vim'
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'vim-scripts/taglist.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/nerdcommenter'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'kien/ctrlp.vim'
Plugin 'mileszs/ack.vim'
Plugin 'mattn/emmet-vim'
"Plugin 'msanders/snipmate.vim'
Plugin 'easymotion/vim-easymotion'
Plugin 'tpope/vim-surround'
Plugin 'ervandew/supertab'
Plugin 'tpope/vim-repeat'
Plugin 'scrooloose/syntastic'
Plugin 'vim-scripts/matchit.zip'
Plugin 'powerline/powerline'
Plugin 'othree/xml.vim'
Plugin 'bling/vim-airline'
Plugin 'majutsushi/tagbar'
Plugin 'vim-php/tagbar-phpctags.vim'
Plugin 'vim-scripts/TaskList.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'vim-scripts/LargeFile'
Plugin 'godlygeek/tabular'
" Track the engine.
Plugin 'SirVer/ultisnips'
" Snippets are separated from the engine. Add this if you want them:
Plugin 'honza/vim-snippets'
Plugin 'vim-scripts/sessionman.vim'
Plugin 'tacahiroy/ctrlp-funky'
Plugin 'eshion/vim-sftp-sync'
Plugin 'dyng/ctrlsf.vim'
Plugin 'flazz/vim-colorschemes'
Bundle 'altercation/vim-colors-solarized'
Bundle 'spf13/vim-colors'
Plugin 'joonty/vdebug'
" PHP {
if count(g:spf13_bundle_groups, 'php')
Bundle 'spf13/PIV'
Bundle 'arnaud-lb/vim-php-namespace'
Bundle 'beyondwords/vim-twig'
endif
" }
" Python {
if count(g:spf13_bundle_groups, 'python')
" Pick either python-mode or pyflakes & pydoc
Bundle 'klen/python-mode'
Bundle 'yssource/python.vim'
Bundle 'python_match.vim'
Bundle 'pythoncomplete'
endif
" }
" Javascript {
if count(g:spf13_bundle_groups, 'javascript')
Bundle 'elzr/vim-json'
Bundle 'groenewege/vim-less'
Bundle 'pangloss/vim-javascript'
Bundle 'briancollins/vim-jst'
Bundle 'kchmck/vim-coffee-script'
endif
" }
" HTML {
if count(g:spf13_bundle_groups, 'html')
Bundle 'amirh/HTML-AutoCloseTag'
Bundle 'hail2u/vim-css3-syntax'
Bundle 'gorodinskiy/vim-coloresque'
Bundle 'tpope/vim-haml'
endif
" }
" Vim Js beautiful {
Bundle 'maksimr/vim-jsbeautify'
" }
" Ruby {
if count(g:spf13_bundle_groups, 'ruby')
Bundle 'tpope/vim-rails'
let g:rubycomplete_buffer_loading = 1
"let g:rubycomplete_classes_in_global = 1
"let g:rubycomplete_rails = 1
endif
" }
"Plugin 'vim-scripts/phpfolding.vim'
"Plugin 'eshion/vim-sync'
" " plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" " Git plugin not hosted on GitHub
" Plugin 'git://git.wincent.com/command-t.git'
" " git repos on your local machine (i.e. when working on your own plugin)
" Plugin 'file:///home/gmarik/path/to/plugin'
"Plugin 'file:///home/neilzhou/.vim/bundle/nerdtree'
"Plugin 'file:///home/neilzhou/.vim/bundle/vim-nerdtree-tabs'
" " The sparkup vim script is in a subdirectory of this repo called vim.
" " Pass the path to set the runtimepath properly.
" Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" " Avoid a name conflict with L9
" Plugin 'user/L9', {'name': 'newL9'}
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" ---------------------END of Vundle Plugin Configuration--------------------
" =================================SET by neil.zhou========================
" Environment {
" Identify platform {
silent function! OSX()
return has('macunix')
endfunction
silent function! LINUX()
return has('unix') && !has('macunix') && !has('win32unix')
endfunction
silent function! WINDOWS()
return (has('win16') || has('win32') || has('win64'))
endfunction
" }
" Basics {
set nocompatible " Must be first line
if !WINDOWS()
set shell=/bin/sh
endif
" }
" Windows Compatible {
" On Windows, also use '.vim' instead of 'vimfiles'; this makes synchronization
" across (heterogeneous) systems easier.
"if WINDOWS()
"set runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after
"endif
" }
" Arrow Key Fix {
" https://github.com/spf13/spf13-vim/issues/780
if &term[:4] == "xterm" || &term[:5] == 'screen' || &term[:3] == 'rxvt'
inoremap <silent> <C-[>OC <RIGHT>
endif
" }
" }
if WINDOWS()
"设定文件编码类型,彻底解决中文编码问题
set encoding=utf-8 "vim的内部编码, Vim 内部所有的 buffer、寄存器、脚本中的字符串等,全都使用这个编码.utf-8
set termencoding=cp936 "Vim 输出到客户终端(Term)的编码类型
set fileencoding=utf-8 "vim 写入文件时采用的编码类型
set fileencodings=ucs-bom,utf-8,gbk,cp936,gb18030,big5,latin1 "当我们打开文件的时候,VIM 按顺序使用 fileencodings 中的编码进行尝试解码
" Also can set as below:
"let &termencoding=&encoding "这里没有设置encoding=xxx,则会是默认值,与操作系统当前locale相同。
"set fileencodings=ucs-bom,utf-8,gbk,cp936
else
" Neil added:
set encoding=utf-8
set termencoding=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,gbk,cp936,gb18030,big5,default,latin1
endif
"=============================================================================================="
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
if has("vms")
set nobackup " do not keep a backup file, use versions instead
else
set nobackup " keep a backup file
" set backup " keep a backup file
endif
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set viewoptions=folds,options,cursor,unix,slash " Better Unix / Windows compatibility
set virtualedit=onemore " Allow for cursor beyond last character
"set spell " Spell checking on
set iskeyword-=. " '.' is an end of word designator
set iskeyword-=# " '#' is an end of word designator
set iskeyword-=- " '-' is an end of word designator
set iskeyword-=58 " ':' is an end of word designator
" add $ for php to as word
autocmd BufRead,BufNewFile *.php setlocal iskeyword+=$
autocmd BufRead,BufNewFile *.php setlocal iskeyword-=-
autocmd BufRead,BufNewFile *.php setlocal iskeyword-=58
autocmd BufRead,BufNewFile *.php setlocal iskeyword-=#
autocmd BufRead,BufNewFile *.php setlocal iskeyword-=.
set nofoldenable " disable folding
" Send more characters for redraws
set ttyfast
set mouse=a " Automatically enable mouse usage
set mousehide " Hide the mouse cursor while typing
" Set this to the name of your terminal that supports mouse codes.
" Must be one of: xterm, xterm2, netterm, dec, jsbterm, pterm
set ttymouse=xterm2
scriptencoding utf-8
"autocmd FileType c,cpp,java,go,php,javascript,puppet,python,rust,twig,xml,yml,perl,sql autocmd BufWritePre <buffer> if !exists('g:spf13_keep_trailing_whitespace') | call StripTrailingWhitespace() | endif
"autocmd FileType go autocmd BufWritePre <buffer> Fmt
autocmd BufNewFile,BufRead *.html.twig set filetype=html.twig
autocmd FileType haskell,puppet,ruby,yml setlocal expandtab shiftwidth=2 softtabstop=2
" preceding line best in a plugin but here for now.
autocmd BufNewFile,BufRead *.coffee set filetype=coffee
" Workaround vim-commentary for Haskell
autocmd FileType haskell setlocal commentstring=--\ %s
" Workaround broken colour highlighting in Haskell
autocmd FileType haskell,rust setlocal nospell
" Wrapped lines goes down/up to next row, rather than next line in file.
noremap j gj
noremap k gk
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")
" Don't use Ex mode, use Q for formatting
map Q gq
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
inoremap <C-U> <C-G>u<C-U>
" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse=a
endif
if LINUX()
execute pathogen#infect()
endif
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
" filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78 formatoptions +=mM
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
" Also don't do it when the mark is in the first line, that is the default
" position when opening a file.
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
let mapleader=","
set tabstop=4
set shiftwidth=4
set softtabstop=4 " Let backspace delete indent
set splitright " Puts new vsplit windows to the right of the current
set splitbelow " Puts new split windows to the bottom of the current
set nu
" shows horizontal line
set cc=78
autocmd FileType haskell,puppet,ruby,yml setlocal expandtab shiftwidth=2 softtabstop=2
set background=dark " Assume a dark background
" Allow to trigger background
function! ToggleBG()
let s:tbg = &background
" Inversion
if s:tbg == "dark"
set background=light
else
set background=dark
endif
endfunction
noremap <leader>bg :call ToggleBG()<CR>
set expandtab
set showmatch
set cursorline
highlight clear SignColumn " SignColumn should match background
highlight clear LineNr " Current line number row will have same background color in relative mode
highlight clear CursorLineNr " Remove highlight color from current line number
"--状态行设置--
set laststatus=2 " 总显示最后一个窗口的状态行;设为1则窗口数多于一个的时候显示最后一个窗口的状态行;0不显示最后一个窗口的状态行
" 选中状态下 复制
if OSX()
" if clipboard is enabled in vim
set clipboard+=unnamed
" or
" vmap "+y :w !pbcopy<CR><CR>
" nmap "+p :r !pbpaste<CR><CR>
else
vnoremap <leader>y "+y
nnoremap <leader>y "+yy
"设置快捷键将系统剪贴板内容粘贴至Vim
nnoremap <leader>p "+p
"共享剪贴板
set clipboard+=unnamed
endif
"自动补全
: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
function! ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endfunction
"Add rename function to rename file using vim
function! RenameFile()
let old_name = expand('%')
let new_name = input('New file name: ', expand('%'), 'file')
if new_name != '' && new_name != old_name
exec ':saveas ' . new_name
exec ':silent !rm ' . old_name
redraw!
endif
endfunction
map <leader>n :call RenameFile()<cr>
map <leader>jx :%!xxd<CR>
" normal mode下按Alt+Right(右箭头)展示下一个tab
:nnoremap <A-Right> :tabn<CR>
:nnoremap <A-Left> :tabp<CR>
:nnoremap <C-N> :tabnew<CR>
" 保存Ctrl+s
:nnoremap <C-s> :w<CR>
:inoremap <C-s> <Esc>:w<CR>a
" 映射全选ctrl+a
nnoremap <C-A> ggVG$
inoremap <C-A> <Esc>ggVG$
"JSON FORMAT {
noremap <leader>jt <Esc>:%!python -m json.tool<CR><Esc>:set filetype=json<CR>
let g:vim_json_syntax_conceal=0
"}
"map tab in insert mode to <leader>tab"
inoremap <leader><leader><tab> <space><space><space><space>
"========================END of common settings==================="
"Settings for NERDTree"
if isdirectory(expand("~/.vim/bundle/nerdtree"))
""autocmd vimenter * NERDTree "default automatical open NERDTree when open vim
"automatical open NERDTree when only vim with no file
""autocmd StdinReadPre * let s:std_in=1
""autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
map <leader><F2> :NERDTreeToggle<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
endif
" Settings for taglist
if isdirectory(expand("~/.vim/bundle/taglist.vim"))
"let Tlist_Use_Right_Window=1 "让taglist窗口出现在Vim的右边
"let Tlist_File_Fold_Auto_Close=1 "当同时显示多个文件中的tag时,设置为1,可使 taglist只显示当前文件tag,其它文件的tag都被折叠起来。
"let Tlist_Show_One_File=1 "只显示一个文件中的tag,默认为显示多个
"let Tlist_Sort_Type='name' "Tag的排序规则,以名字排序。默认是以在文件中出现 的顺序排序
"let Tlist_GainFocus_On_ToggleOpen=1 "Taglist窗口打开时,立刻切换为有焦点状态
"let Tlist_Exit_OnlyWindow=1 "如果taglist窗口是最后一个窗口,则退出vim
"let Tlist_WinWidth=32 "设置窗体宽度为32,可以根据自己喜好设置
"let Tlist_Ctags_Cmd='/usr/bin/ctags' " 注意路径不能有空格
"
"map <leader>t :TlistToggle<CR> "热键设置,我设置成Leader+t来呼出和关闭Taglist
endif
" Settings for ag
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
" settings for ctags
" 在项目目录中新建一个vimscript
" 目录,制定tags路径,可以通过下面配置加载vimscript文件。
if executable('ctags')
" if getfsize("vimscript")>0
" source vimscript
" endif
" 按下Ctrl+F12 更新tags,当有代码更新的时候。
nnoremap <C-F12> :!ctags -R<CR>
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" cscope setting
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has("cscope")
" set csprg=/usr/bin/cscope
"set csprg=/usr/bin/cscope
set csto=1
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
endif
set csverb
let g:CurrentDir = getcwd()
if WINDOWS()
"for windows
let g:CscopeAddString = "cs add " . g:CurrentDir . "\\cscope.out " . g:CurrentDir
nnoremap <leader><F5> :!dir /s /b *.php > cscope.files<CR>:!ctags -L cscope.files<CR>:!cscope -b<CR>:cs kill -1<CR>:exe CscopeAddString<CR><CR>
"elseif LINUX()
else
"for linux:
let g:CscopeAddString = "cs add " . g:CurrentDir . "/cscope.out " . g:CurrentDir
"nnoremap <leader><F5> :!find . -type f -name "*.*" -not -name ".*" > cscope.files<CR>:!ctags -L cscope.files<CR>:!cscope -b<CR>:cs kill -1<CR>:exe CscopeAddString<CR><CR>
nnoremap <leader><F5> :!find . -type f -name "*.php" -o -name "*.inc" -not -name ".*" > cscope.files<CR>:!ctags -L cscope.files<CR><CR>
endif
endif
"show results of cscope using quickfix window, which you can type :cw to view quickfix window and Ctrl+^ to view original place of codes
set cscopequickfix=s-,c-,d-,i-,t-,e-
nmap <C-@>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-@>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-@>d :cs find d <C-R>=expand("<cword>")<CR>
"Settings for snipmate
let g:snips_author = 'Neil.zhou'
"Settigns for syntastic"
if isdirectory(expand("~/.vim/bundle/syntastic"))
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
endif
"Settings for airline"
if isdirectory(expand("~/.vim/bundle/vim-airline"))
"Automatically displays all buffers when there's only one tab open.
""let g:airline#extensions#tabline#buffer_idx_mode = 1
""let g:airline#extensions#tabline#enabled = 1
""let g:airline#extensions#tabline#left_sep = ' '
""let g:airline#extensions#tabline#left_alt_sep = '|'
""nmap <leader>1 <Plug>AirlineSelectTab1
""nmap <leader>2 <Plug>AirlineSelectTab2
""nmap <leader>3 <Plug>AirlineSelectTab3
endif
"powerline
if isdirectory(expand("~/.vim/bundle/powerline"))
"let g:airline_powerline_fonts = 1
"powerline{
set guifont=PowerlineSymbols\ for\ Powerline
" set nocompatible
set t_Co=256
let g:Powerline_symbols = 'fancy'
"}
endif
"Settings for phpctags
if executable('phpctags')
if LINUX()
"let g:tagbar_phpctags_bin='/usr/share/php5/phpctags' " if phpctags placed at php5 folder.
"let g:tagbar_phpctags_bin='/usr/local/bin/phpctags'
elseif WINDOWS()
"let g:tagbar_phpctags_bin='C:\tools_bin\phpctags'
endif
"The amount of memory that phpctags can use can be configured as such:
let g:tagbar_phpctags_memory_limit = '512M'
endif
"Settings for tagbar"
if isdirectory(expand("~/.vim/bundle/tagbar"))
let g:tagbar_autofocus = 1
nnoremap <leader><F3> :TagbarToggle<CR>
endif
"Settings for tasklist
if isdirectory(expand("~/.vim/bundle/TaskList.vim"))
"tasklist{
map <leader>td <Plug>TaskList
"}
endif
"Settings for largefile , 默认单位是 MB
if isdirectory(expand("~/.vim/bundle/LargeFile"))
let g:LargeFile = 10
endif
"Settings for Ultisnips
if isdirectory(expand("~/.vim/bundle/ultisnips"))
"Ultisnips{
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
"set runtimepath for .vim so that ~/.vim/UltiSnips directory can be found in
"runtimepath when load snips files
set rtp+=~/.vim
"let g:UltiSnipsSnippetDirectories=['UltiSnips']
let g:UltiSnipsSnippetsDir = '~/.vim/UltiSnips'
let g:UltiSnipsExpandTrigger="<leader><tab>"
"let g:UltiSnipsJumpForwardTrigger="<c-j>"
"let g:UltiSnipsJumpBackwardTrigger="<c-k>"
if has('python3')
"here we use python3.5"
let g:UltiSnipsUsePythonVersion = 3
endif
" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"
"}
endif
if isdirectory(expand("~/.vim/bundle/supertab"))
"supertab {
let g:SuperTabDefaultCompletionType="<C-Tab>"
"}"
endif
if isdirectory(expand("~/.vim/bundle/xml.vim"))
" xml settings {{{ "
let g:makeElementSuf = '<Ctrl>;'
" }}} xml settings "
endif
" settings for Plugin CtrlP configuration
if isdirectory(expand("~/.vim/bundle/ctrlp.vim/"))
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode='ra'
"set nearest ancestor that contains custom markers eg. tags. which will be
"precedure of default root markers like '.git', '.svn' and so on
let g:ctrlp_root_markers=['.git','.svn','tags']
if WINDOWS()
""Windows
set wildignore+='*\\tmp\*,*.swp,*.zip,*.exe'
"let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' "Windows
else
""Linux/Mac
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,tags,cscope.*,.git/*
"let g:ctrlp_user_command = 'find %s -type f' " Linux/MAC
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)$',}
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.hg$\|\.svn$',
\ 'file': '\.exe$\|\.so$\|\.dll$\|\.pyc$' }
if executable('ag')
let s:ctrlp_fallback = 'ag %s --nocolor -l -g ""'
elseif executable('ack-grep')
let s:ctrlp_fallback = 'ack-grep %s --nocolor -f'
elseif executable('ack')
let s:ctrlp_fallback = 'ack %s --nocolor -f'
" On Windows use "dir" as fallback command.
elseif WINDOWS()
let s:ctrlp_fallback = 'dir %s /-n /b /s /a-d'
else
let s:ctrlp_fallback = 'find %s -type f'
endif
if exists("g:ctrlp_user_command")
unlet g:ctrlp_user_command
endif
let g:ctrlp_user_command = {
\ 'types': {
\ 1: ['.git', 'cd %s && git ls-files . --cached --exclude-standard --others'],
\ 2: ['.hg', 'hg --cwd %s locate -I .'],
\ },
\ 'fallback': s:ctrlp_fallback
\ }
if isdirectory(expand("~/.vim/bundle/ctrlp-funky/"))
" CtrlP extensions
let g:ctrlp_extensions = ['funky']
"funky
nnoremap <Leader>fu :CtrlPFunky<Cr>
endif
endif
" settings for ack
if executable('ack')
if WINDOWS()
let g:ackprg="ack -H --nocolor --nogroup"
function! Ack(args)
let grepprg_bak=&grepprg
exec "set grepprg=" . g:ackprg
execute "silent! grep " . a:args
botright copen
let &grepprg=grepprg_bak
exec "redraw!"
endfunction
command! -nargs=* -complete=file Ack call Ack(<q-args>)
endif
endif
" Tabularize {
if isdirectory(expand("~/.vim/bundle/tabular"))
nmap <Leader>a& :Tabularize /&<CR>
vmap <Leader>a& :Tabularize /&<CR>
nmap <Leader>a= :Tabularize /^[^=]*\zs=<CR>
vmap <Leader>a= :Tabularize /^[^=]*\zs=<CR>
nmap <Leader>a=> :Tabularize /=><CR>
vmap <Leader>a=> :Tabularize /=><CR>
nmap <Leader>a=? :Tabularize /=?<CR>
vmap <Leader>a=? :Tabularize /=?<CR>
nmap <Leader>a: :Tabularize /:<CR>
vmap <Leader>a: :Tabularize /:<CR>
nmap <Leader>a:: :Tabularize /:\zs<CR>
vmap <Leader>a:: :Tabularize /:\zs<CR>
nmap <Leader>a, :Tabularize /,<CR>
vmap <Leader>a, :Tabularize /,<CR>
nmap <Leader>a,, :Tabularize /,\zs<CR>
vmap <Leader>a,, :Tabularize /,\zs<CR>
nmap <Leader>a<Bar> :Tabularize /<Bar><CR>
vmap <Leader>a<Bar> :Tabularize /<Bar><CR>
endif
" }
" Session List {
set sessionoptions=blank,buffers,curdir,folds,tabpages,winsize
if isdirectory(expand("~/.vim/bundle/sessionman.vim/"))
nmap <leader>sl :SessionList<CR>
nmap <leader>ss :SessionSave<CR>
nmap <leader>sc :SessionClose<CR>
endif
" }
" sftp sync {
if isdirectory(expand("~/.vim/bundle/vim-sftp-sync"))
"let g:vim_sftp_configs = {
"\ 'sample_server_1' : {
"\ 'upload_on_save' : 1,
"\ 'download_on_open' : 0,
"\ 'confirm_downloads': 1,
"\ 'confirm_uploads' : 0,
"\ 'local_base_path' : '/Users/name/sample/',
"\ 'remote_base_path' : '/var/www/sample/',
"\ 'sftp_command' : 'ftp',
"\ 'user' : 'username',
"\ 'pass' : 'password',
"\ 'host' : '127.0.0.1'
"\ },
"\ 'sample_server_2' : {
"\ 'upload_on_save' : 1,
"\ 'download_on_open' : 1,
"\ 'confirm_downloads': 0,
"\ 'confirm_uploads' : 0,
"\ 'local_base_path' : '/Users/development',
"\ 'remote_base_path' : '/var/www/development/trunk/',
"\ 'sftp_command' : 'sftp',
"\ 'complete_prompt_regexp' : '100\%',
"\ 'user' : 'username',
"\ 'pass' : 'password',
"\ 'host' : '-P23 [email protected]'
"\ }
"\}
endif
" }"
" dyng/ctrlsf.vim {{{ "
if isdirectory(expand("~/.vim/bundle/ctrlsf.vim"))
nmap <Leader>f <Plug>CtrlSFPrompt
vmap <Leader>f <Plug>CtrlSFVwordPath
vmap <Leader>F <Plug>CtrlSFVwordExec
nmap <Leader>fn <Plug>CtrlSFCwordPath
nmap <Leader>fp <Plug>CtrlSFPwordPath
nnoremap <Leader>fo :CtrlSFOpen<CR>
nnoremap <Leader><F4> :CtrlSFToggle<CR>
inoremap <Leader><F4> <Esc>:CtrlSFToggle<CR>
endif
" }}} dyng/ctrlsf.vim "
" vim UI scheme {{{
if filereadable(expand("~/.vim/bundle/vim-colors-solarized/colors/solarized.vim"))
let g:solarized_termcolors=256
let g:solarized_termtrans=1
let g:solarized_contrast="normal"
let g:solarized_visibility="normal"
color solarized " Load a colorscheme
endif
"}}}"
" YouCompleteMe {
if count(g:spf13_bundle_groups, 'youcompleteme')
let g:acp_enableAtStartup = 0
" enable completion from tags
let g:ycm_collect_identifiers_from_tags_files = 1
" 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 ruby setlocal omnifunc=rubycomplete#Complete
autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc
" Haskell post write lint and check with ghcmod
" $ `cabal install ghcmod` if missing and ensure
" ~/.cabal/bin is in your $PATH.
if !executable("ghcmod")
autocmd BufWritePost *.hs GhcModCheckAndLintAsync
endif
" For snippet_complete marker.
if !exists("g:spf13_no_conceal")
if has('conceal')
set conceallevel=2 concealcursor=i
endif
endif
" Disable the neosnippet preview candidate window
" When enabled, there can be too much visual noise
" especially when splits are used.
set completeopt-=preview
endif
" }
" PyMode {
" Disable if python support not present
if !has('python')
let g:pymode = 0
endif
if isdirectory(expand("~/.vim/bundle/python-mode"))
let g:pymode_lint_checkers = ['pyflakes']
let g:pymode_trim_whitespaces = 0
let g:pymode_options = 0
let g:pymode_rope = 0
endif
" }
" PIV {
if isdirectory(expand("~/.vim/bundle/PIV"))
"let g:DisableAutoPHPFolding = 0
let g:PIVAutoClose = 0
let g:DisableAutoPHPFolding = 1
endif
" }
" Vdebug
let g:vdebug_options= {
\ "port" : 9000,
\ "server" : '',
\ "timeout" : 40,
\ "on_close" : 'detach',
\ "break_on_open" : 0,
\ "ide_key" : '',
\ "path_maps" : {},
\ "debug_window_level" : 0,
\ "debug_file_level" : 0,
\ "debug_file" : "",
\ "watch_window_style" : 'expanded',
\ "marker_default" : '⬦',
\ "marker_closed_tree" : '▸',
\ "marker_open_tree" : '▾'
\}
" debug for remote server
"let g:vdebug_options['path_maps'] = {"/apache/dev/htdocs/web_pa/pa/ALS": "/Users/neilzhou/Documents/Projects/activehuntfish/ALS_WEB_PA/branches/pahf_r1.03.77/ALS", "/apache/dev/htdocs/web_pa/util":"/Users/neilzhou/Documents/Projects/activehuntfish/UTIL_WEB/branches/pahf_r1.03.77/util", "/apache/dev/htdocs/web_pa/libs":"/Users/neilzhou/Documents/Projects/activehuntfish/LIBS_WEB/branches/pahf_r1.03.77/libs", "/apache/dev/htdocs/web_pa/pa":"/Users/neilzhou/Documents/Projects/activehuntfish/LIBS_WEB/branches/pahf_r1.03.77/libs"}
" JS beautiful {
if isdirectory(expand("~/.vim/bundle/vim-jsbeautify"))
".vimrc
map <leader>jb :call JsBeautify()<cr>
" or
autocmd FileType javascript noremap <buffer> <leader>jb :call JsBeautify()<cr>
" for json
autocmd FileType json noremap <buffer> <leader>jb :call JsonBeautify()<cr>
" for jsx
autocmd FileType jsx noremap <buffer> <leader>jb :call JsxBeautify()<cr>
" for html
autocmd FileType html noremap <buffer> <leader>jb :call HtmlBeautify()<cr>
" for css or scss
autocmd FileType css noremap <buffer> <leader>jb :call CSSBeautify()<cr>
".vimrc for range
map <leader>jr :call RangeJsBeautify()<cr>
autocmd FileType javascript vnoremap <buffer> <leader>jr :call RangeJsBeautify()<cr>
autocmd FileType json vnoremap <buffer> <leader>jr :call RangeJsonBeautify()<cr>
autocmd FileType jsx vnoremap <buffer> <leader>jr :call RangeJsxBeautify()<cr>
autocmd FileType html vnoremap <buffer> <leader>jr :call RangeHtmlBeautify()<cr>
autocmd FileType css vnoremap <buffer> <leader>jr :call RangeCSSBeautify()<cr>
endif
" }