-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc.bundles
303 lines (218 loc) · 7.31 KB
/
.vimrc.bundles
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
"""""""""""Vundle设置"""""""""""
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'scrooloose/nerdcommenter'
Plugin 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plugin 'junegunn/fzf.vim'
Plugin 'mileszs/ack.vim'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-repeat'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-scripts/ctags.vim'
Plugin 'majutsushi/tagbar'
Plugin 'easymotion/vim-easymotion'
Plugin 'altercation/vim-colors-solarized'
Plugin 'nathanaelkane/vim-indent-guides'
" Plugin 'SirVer/ultisnips'
Plugin 'fatih/vim-go'
Plugin 'stamblerre/gocode', {'rtp': 'vim/'}
Plugin 'Valloric/YouCompleteMe'
Plugin 'haya14busa/incsearch.vim'
Plugin 'sjl/gundo.vim'
Plugin 'Raimondi/delimitMate'
Plugin 'scrooloose/syntastic'
Plugin 'mhinz/vim-startify'
Plugin 'godlygeek/tabular'
Plugin 'suan/vim-instant-markdown'
" Plugin 'tpope/vim-fugitive'
Plugin 'jsfaint/gen_tags.vim'
" ...
call vundle#end()
filetype plugin indent on
"""""""""""NERDTree""""""""""""
" 切换显示NERDtree
map <C-e> :NERDTreeToggle<CR>
" 在NERDtree中找到当前文件的位置
map <leader>e :NERDTreeFind<CR>
" 当最后只剩nerdtree目录时,直接关闭vim
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" nerdtree需要被忽略的文件
let NERDTreeIgnore=['\.py[cd]$', '\~$', '\.swo$', '\.swp$', '^\.git$', '^\.hg$', '^\.svn$', '\.bzr$']
" 设置为1时,显示nerdtree文件层次的编号.
let NERDTreeShowLineNumbers=1
"""""""""""nerdtree-git-plugin"""""""""""
" nerdtree 目录的 git 状态相关符号
let g:NERDTreeIndicatorMapCustom = {
\ "Modified" : "✹",
\ "Staged" : "✚",
\ "Untracked" : "✭",
\ "Renamed" : "➜",
\ "Unmerged" : "═",
\ "Deleted" : "✖",
\ "Dirty" : "✗",
\ "Clean" : "✔︎",
\ 'Ignored' : '☒',
\ "Unknown" : "?"
\ }
"""""""""""nerdcommenter"""""""""""
" 注释的时候自动加个空格, 强迫症必配
let g:NERDSpaceDelims = 1
"""""""""""fzf.vim"""""""""""
" 映射 :Files 命令到 Ctrl+p
nnoremap <silent> <C-p> :Files<CR>
"""""""""""ack.vim"""""""""""
" 映射 :Ack 命令到 <leader>a
map <leader>a :Ack<space>
"""""""""""vim-airline"""""""""""
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_left_sep = '▶'
let g:airline_left_alt_sep = '❯'
let g:airline_right_sep = '◀'
let g:airline_right_alt_sep = '❮'
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.branch = '⎇'
" 是否打开tabline
let g:airline#extensions#tabline#enabled = 1
" 这个是安装字体后 必须设置此项"
let g:airline_powerline_fonts = 1
" 设置切换Buffer快捷键"
nnoremap <C-left> :bp<CR>
nnoremap <C-right> :bn<CR>
"""""""""""tagbar"""""""""""
nnoremap <silent> tb :TagbarToggle<CR>
" gotags 配置
let g:tagbar_type_go = {
\ 'ctagstype' : 'go',
\ 'kinds' : [
\ 'p:package',
\ 'i:imports:1',
\ 'c:constants',
\ 'v:variables',
\ 't:types',
\ 'n:interfaces',
\ 'w:fields',
\ 'e:embedded',
\ 'm:methods',
\ 'r:constructor',
\ 'f:functions'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 't' : 'ctype',
\ 'n' : 'ntype'
\ },
\ 'scope2kind' : {
\ 'ctype' : 't',
\ 'ntype' : 'n'
\ },
\ 'ctagsbin' : 'gotags',
\ 'ctagsargs' : '-sort -silent'
\ }
"""""""""""vim-easymotion"""""""""""
" 前缀映射
map <leader> <Plug>(easymotion-prefix)
let g:EasyMotion_smartcase = 1
" map <Leader>l <Plug>(easymotion-lineforward)
" map <Leader>j <Plug>(easymotion-j)
" map <Leader>k <Plug>(easymotion-k)
" map <Leader>h <Plug>(easymotion-linebackward)
"""""""""""vim-colors-solarized"""""""""""
" solarized配色方案设置
let g:NERDSpaceDelims=1
syntax enable
let g:solarized_termcolors=256
let g:solarized_termtrans=1
let g:solarized_contrast="normal"
let g:solarized_visibility="normal"
set background=dark
colorscheme solarized
"""""""""""rainbow"""""""""""
let g:rainbow_active = 1
"""""""""""vim-indent-guides"""""""""""
" 对齐线
let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
nnoremap <silent> eg :IndentGuidesEnable<CR>
nnoremap <silent> xg :IndentGuidesDisable<CR>
"""""""""""ultisnips"""""""""""
" TODO
"""""""""""vim-go"""""""""""
let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
let g:go_def_mode = 'gopls'
let g:go_autodetect_gopath = 1
let g:go_def_mod_mode='godef'
au FileType go nmap <leader>r <Plug>(go-run)
au FileType go nmap <Leader>gd <Plug>(go-doc)
au FileType go nmap <Leader>i <Plug>(go-imports)
au FileType go nmap <Leader>s <Plug>(go-implements)
au FileType go nmap <Leader>f <Plug>(gofmt)
au FileType go nmap <Leader>t <Plug>(go-test)
"""""""""""gocode"""""""""""
filetype plugin on
imap <C-a> <C-x><C-o>
""""""""""""YouCompleteMe"""""""""""
set runtimepath+=~/.vim/bundle/YouCompleteMe
let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/third_party/ycmd/.ycm_extra_conf.py'
let g:ycm_collect_identifiers_from_tags_files = 1 " 开启 YCM 基于标签引擎
let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 注释与字符串中的内容也用于补全
let g:syntastic_ignore_files=[".*\.py$"]
let g:ycm_seed_identifiers_with_syntax = 1 " 语法关键字补全
let g:ycm_complete_in_comments = 1 " 在注释输入中也能补全
let g:ycm_complete_in_strings = 1 " 在字符串输入中也能补全
let g:ycm_key_list_select_completion = ['<c-n>', '<Down>'] " 映射按键, 没有这个会拦截掉tab
let g:ycm_path_to_python_interpreter="/usr/local/bin/python3"
let g:ycm_error_symbol = '>>'
let g:ycm_warning_symbol = '>*'
nnoremap <leader>d :YcmCompleter GoToDeclaration<CR>
nnoremap <leader>f :YcmCompleter GoToDefinition<CR>
nnoremap <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
nmap <F4> :YcmDiags<CR>
" if has('python3')
" silent! python3 1
" endif
"""""""""""insearch.vim"""""""""""
set hlsearch
let g:incsearch#auto_nohlsearch = 1
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
"""""""""""gundo"""""""""""
nnoremap <leader>u :GundoToggle<CR>
"""""""""""delimitMate"""""""""""
let delimitMate_expand_cr = 1
"""""""""""syntastic"""""""""""
let g:syntastic_error_symbol='>>'
let g:syntastic_warning_symbol='>'
let g:syntastic_check_on_open=1
let g:syntastic_check_on_wq=0
let g:syntastic_enable_highlighting=1
let g:syntastic_python_checkers=['pyflakes'] " 使用pyflakes,速度比pylint快
let g:syntastic_javascript_checkers = ['jsl', 'jshint']
let g:syntastic_html_checkers=['tidy', 'jshint']
" 修改高亮的背景色, 适应主题
highlight SyntasticErrorSign guifg=white guibg=black
" to see error location list
let g:syntastic_always_populate_loc_list = 0
let g:syntastic_auto_loc_list = 0
let g:syntastic_loc_list_height = 5
function! ToggleErrors()
let old_last_winnr = winnr('$')
lclose
if old_last_winnr == winnr('$')
" Nothing was closed, open syntastic error location panel
Errors
endif
endfunction
nnoremap <Leader>s :call ToggleErrors()<cr>
" nnoremap <Leader>sn :lnext<cr>
" nnoremap <Leader>sp :lprevious<cr>
"""""""""""vim-instant-markdown"""""""""""
let g:instant_markdown_autostart = 0
nnoremap <leader><leader>m :InstantMarkdownPreview<cr>