-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
313 lines (268 loc) · 7.11 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
"###############################################
"# VIM configuration file
"# Author : Yuetao Jiang([email protected])
"# NT ID : jiangy9
"###############################################
"use VIM settings, rather than VI settings
set nocompatible
"encoding
set encoding=utf-8
"display line number
set nu
"keep 50 command lines history
set history=50
set ic
set term=screen-256color
"syntax highlight
syntax enable
"use default syntax highlight
syntax on
"code fold
"set foldmethod=indent
set foldmethod=syntax
set nofoldenable
"""""""""""""""""""""""
"COLORS START
"""""""""""""""""""""""
"#1
"set background=dark
"let g:solarized_termcolors=256
"colorscheme solarized
"#2
"let g:molokai_original = 1
"let g:rehash256 = 1
set t_Co=256
colorscheme molokai
"#3
"colorscheme twilight
"#4
"colorscheme desert
"""""""""""""""""""""""
" COLORS END
"""""""""""""""""""""""
"display real information of cursor
set ruler
"set rulerformat=%20(%2*%<%f%=\ %m%r\ %31\ %c\ %p%%%)
"display incomplete commands
set showcmd
"higtlight search
set hlsearch
"incremental search, highlight every character when input
set incsearch
"highlight current row and column
"set cursorline
"set cursorcolumn
"parenthesis highlight matching
set showmatch
"always display status line(last line)
set laststatus=2
"disable mouse
set mouse=
"VIM commands smart completion
set wildmenu
"indent settings
set ts=4
set sw=4
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set cindent
set smartindent
"fold code block based on indent or syntax
"set foldmethod=indent
set foldmethod=syntax
set nofoldenable
"enable file type detection
filetype off
"""""""""""""""""""""""
" Vundle START
"""""""""""""""""""""""
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"call vundle#begin('~/some/path/here')
Plugin 'VundleVim/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'Lokaltog/vim-powerline'
"Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'majutsushi/tagbar'
Plugin 'mileszs/ack.vim'
"color scheme
Plugin 'altercation/vim-colors-solarized'
Plugin 'tomasr/molokai'
"""Bundles
Bundle 'Valloric/YouCompleteMe'
call vundle#end()
filetype plugin indent on
"filetype plugin on
"""""""""""""""""""""""
" Vundle END
"""""""""""""""""""""""
"""""""""""""""""""""""
" YCM START
"""""""""""""""""""""""
nnoremap <leader>gl :YcmCompleter GoToDeclaration<CR>
nnoremap <leader>gf :YcmCompleter GoToDefinition<CR>
"Go to definition else declaration
nnoremap <leader>gg :YcmCompleter GoToDefinitionElseDeclaration<CR>
"let g:ycm_complete_in_comments=1
"let g:ycm_collect_identifiers_from_tags_files=1
"set completeopt-=preview
"let g:ycm_min_num_of_chars_for_completion=1
"let g:ycm_cache_omnifunc=0
"let g:ycm_seed_identifiers_with_syntax=1
let g:ycm_global_ycm_extra_conf = '~/ycm_extra_conf.py'
let g:ycm_key_invoke_completion = '<C-a>'
"""""""""""""""""""""""
" YCM END
"""""""""""""""""""""""
"""""""""""""""""""""""
" NERD TREE START
"""""""""""""""""""""""
map <C-n> :NERDTreeToggle<CR>
" autocmd vimenter * NERDTree
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
"""""""""""""""""""""""
" NERD TREE END
"""""""""""""""""""""""
"""""""""""""""""""""""
" TAGBAR START
"""""""""""""""""""""""
nmap <F8> :TagbarToggle<CR>
" autocmd VimEnter * nested :call tagbar#autoopen(1)
let g:tagbar_compact=1
let g:tagbar_type_cpp = {
\ 'kinds' : [
\ 'c:classes:0:1',
\ 'd:macros:0:1',
\ 'e:enumerators:0:0',
\ 'f:functions:0:1',
\ 'g:enumeration:0:1',
\ 'l:local:0:1',
\ 'm:members:0:1',
\ 'n:namespaces:0:1',
\ 'p:functions_prototypes:0:1',
\ 's:structs:0:1',
\ 't:typedefs:0:1',
\ 'u:unions:0:1',
\ 'v:global:0:1',
\ 'x:external:0:1'
\ ],
\ 'sro' : '::',
\ 'kind2scope' : {
\ 'g' : 'enum',
\ 'n' : 'namespace',
\ 'c' : 'class',
\ 's' : 'struct',
\ 'u' : 'union'
\ },
\ 'scope2kind' : {
\ 'enum' : 'g',
\ 'namespace' : 'n',
\ 'class' : 'c',
\ 'struct' : 's',
\ 'union' : 'u'
\ }
\ }
"""""""""""""""""""""""
" TAGBAR END
"""""""""""""""""""""""
"""""""""""""""""""""""
" INDENT GUIDE START
"""""""""""""""""""""""
"let g:indent_guides_enable_on_vim_startup=1
"let g:indent_guides_start_level=2
"let g:indent_guides_guide_size=1
"""""""""""""""""""""""
" INDENT GUIDE END
"""""""""""""""""""""""
"""""""""""""""""""""""
" POWERLINE START
"""""""""""""""""""""""
"let g:Powerline_symbols = "unicode"
"let g:Powerline_symbols = 'fancy'
"""""""""""""""""""""""
" POWERLINE END
"""""""""""""""""""""""
"""""""""""""""""""""""
" CSCOPE START
"""""""""""""""""""""""
if has("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
else
let cscope_file=findfile("cscope.out", ".;")
let cscope_pre=matchstr(cscope_file, ".*/")
if !empty(cscope_file) && filereadable(cscope_file)
exe "cs add" cscope_file cscope_pre
endif
endif
set csverb
endif
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><CR>
"""""""""""""""""""""""
" CSCOPE END
"""""""""""""""""""""""
"""""""""""""""""""""""
" ACK.VIM START
"""""""""""""""""""""""
nmap <F7> :Ack -i<space>
"""""""""""""""""""""""
" ACK.VIM END
"""""""""""""""""""""""
"??
filetype indent on
autocmd FileType python setlocal et sta sw=4 sts=4
"""""""""""""""""""""""
" auto add Python header -START
"""""""""""""""""""""""
"autocmd BufNewFile *.py 0r ~/.templates/python_header
"autocmd BufNewFile *.py ks|call FileName()|'s
"autocmd BufNewFile *.py ks|call CreatedTime()|'s
"
"fun FileName()
" if line("$") > 11
" let l = 12
" else
" let l = line("$")
" endif
" exe "1," . l . "g/File Name : .*/s/File Name : .*/File Name : " .expand("%")
"endfun
"
"fun CreatedTime()
" if line("$") > 11
" let l = 12
" else
" let l = line("$")
" endif
"exe "1," . l . "g/Created Time : .*/s/Created Time : .*/Created Time : " .strftime("%Y-%m-%d %T")
"endfun
"""""""""""""""""""""""
" auto add Python header -END
"""""""""""""""""""""""
"""""""""""""""""""""""
" tool : pydiction
"""""""""""""""""""""""
filetype plugin on
"let g:pydiction_location = '/Users/ytjiang/.vim/complete-dict'
"command perfix buttom
let mapleader=";"
" CTAGS
set tags=./tags,tags;$HOME