-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc.bundles
346 lines (319 loc) · 11.6 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
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
" ======================
" vim-plug插件配置与安装
" ======================
" =============== 依赖说明 ===============[[[1
" Python依赖: pip install flake8 pep8-naming isort jedi
" ]]]
" ================= 插件管理 =====================[[[1
if !exists('g:bundle_groups') " inspired by spf13, 自定义需要的插件集合
" \'latex',
let g:bundle_groups=[
\'python',
\'beta',
\'markdown',
\'nginx',
\]
endif
call plug#begin('~/.config/nvim/bundle')
" 自动补全插件[[[2
" 代码片段快速插入
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" 自动补全单引号,双引号等
Plug 'Raimondi/delimitMate'
" ]]]
" 编辑插件[[[2
" 快速注释
Plug 'tpope/vim-commentary'
" 快速加入修改环绕字符
Plug 'tpope/vim-surround'
" 快速去行尾空格
Plug 'ntpeters/vim-better-whitespace'
" 多光标选中编辑
Plug 'terryma/vim-multiple-cursors'
" ]]]
" 快速定位插件 [[[2
" ctrlsf
" 类似sublimetext的搜索
" In CtrlSF window:
" O - 在当前窗口打开
" p - 在预览窗口中打开,按Q退出预览窗口
" t 在tab中打开(建议)
" T - Lkie t but focus CtrlSF window instead of opened new tab.
" q - Quit CtrlSF window.
Plug 'dyng/ctrlsf.vim'
" 文件内快速定位
Plug 'easymotion/vim-easymotion'
" fzf
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
" ]]]
" 功能插件[[[2
" vimwiki
Plug 'vimwiki/vimwiki'
" ]]]
" 显示插件[[[2
" 括号显示增强
Plug 'kien/rainbow_parentheses.vim'
" 主题 solarized
Plug 'altercation/vim-colors-solarized'
" 显示Mark
Plug 'kshenoy/vim-signature'
" ]]]
" 导航插件[[[2
" nerdtree nerdtreetabs
Plug 'scrooloose/nerdtree' | Plug 'jistr/vim-nerdtree-tabs'
" tagbar
Plug 'majutsushi/tagbar'
" ]]]
" 语言相关[[[2
" markdown[[[3
if count(g:bundle_groups, 'markdown')
Plug 'plasticboy/vim-markdown', {'for': 'md'}
endif
" ]]]
" Python[[[3
if count(g:bundle_groups, 'python')
" for python.vim syntax highlight
" pythonsyntax
Plug 'hdima/python-syntax'
endif
" ]]]
" Nginx[[[3
if count(g:bundle_groups, 'nginx')
Plug 'bwangel23/nginx-vim-syntax'
endif
" ]]]
" ]]]
if count(g:bundle_groups, 'beta')
endif
call plug#end()
" ]]]
" ==================== 插件配置 ========================[[[1
" 自动补全插件[[[2
" ultisnips [[[3
let g:UltiSnipsExpandTrigger = "<tab>"
" 定义存放代码片段的文件夹 .vim/UltiSnips下,使用自定义和默认的,将会的到全局,有冲突的会提示
let g:UltiSnipsSnippetsDir = '~/.vim/UltiSnips'
" 进入对应filetype的snippets进行编辑
map <leader>n :UltiSnipsEdit<CR>
" ctrl+j/k 进行选择
func! g:JInYCM()
if pumvisible()
return "\<C-n>"
else
return "\<c-j>"
endif
endfunction
func! g:KInYCM()
if pumvisible()
return "\<C-p>"
else
return "\<c-k>"
endif
endfunction
inoremap <c-j> <c-r>=g:JInYCM()<cr>
au BufEnter,BufRead * exec "inoremap <silent> " . g:UltiSnipsJumpBackwordTrigger . " <C-R>=g:KInYCM()<cr>"
let g:UltiSnipsJumpBackwordTrigger = "<c-k>"
" ]]]
" delimitMate [[[3
" for python docstring ",优化输入
au FileType python let b:delimitMate_nesting_quotes = ['"']
au FileType php let delimitMate_matchpairs = "(:),[:],{:}"
" 关闭某些类型文件的自动补全
"au FileType mail let b:delimitMate_autoclose = 0
" ]]]
" ]]]
" 编辑插件[[[2
" vim-commentary [[[3
autocmd FileType nginx setlocal commentstring=#\ %s
autocmd FileType sql setlocal commentstring=--\ %s
autocmd FileType awk setlocal commentstring=#\ %s
" ]]]
" trailingwhitespace [[[
map <leader>t :StripWhitespace<CR>
autocmd FileType c,cpp,java,go,puppet,python,rust,twig,xml,yml,perl autocmd BufEnter <buffer> EnableStripWhitespaceOnSave
" ]]]
" multiplecursors [[[3
let g:multi_cursor_use_default_mapping=0
" Default mapping
let g:multi_cursor_next_key='<C-m>'
let g:multi_cursor_prev_key='<C-p>'
let g:multi_cursor_skip_key='<C-x>'
let g:multi_cursor_quit_key='<Esc>'
" ]]]
" ]]]
" 快速定位插件[[[2
" ctrlsf [[[3
nmap <leader>q <Plug>CtrlSFPrompt
vmap <leader>q <Plug>CtrlSFVwordPath
" let g:ctrlsf_position = 'below'
" let g:ctrlsf_winsize = '30%'
let g:ctrlsf_auto_close = 0
let g:ctrlsf_confirm_save = 0
" Note: cannot use <CR> or <C-m> for open
" Use : <sapce> or <tab>
let g:ctrlsf_mapping = {
\ "open" : "<Space>",
\ "openb" : "O",
\ "tab" : "t",
\ "tabb" : "T",
\ "prevw" : "p",
\ "quit" : "q",
\ "next" : "<C-N>",
\ "prev" : "<C-P>",
\ "pquit" : "q",
\ }
" ]]]
" vim-easymotion [[[3
let g:EasyMotion_smartcase = 1
map <leader>j <Plug>(easymotion-j)
map <leader>k <Plug>(easymotion-k)
" 重复上一次操作, 类似repeat插件, 很强大
map <leader>. <Plug>(easymotion-repeat)
" ]]]
" fzf [[[3
nmap <leader>p :FZF<CR>
" ]]]
" fzf.vim[[[3
" 显示所有Buffer
nnoremap <leader>p :Files<CR>
nnoremap <leader>l :Buffers<CR>
nnoremap <leader>m :Maps<CR>
nnoremap <leader>c :Commits<CR>
nnoremap <leader>h :BTags<CR>
let g:fzf_layout = { 'window': '-tabnew', 'down': '~40%' }
" ]]]
" ]]]
" 功能插件[[[2
" vimwiki [[[3
nmap <leader>v <Plug>VimwikiIndex
let g:vimwiki_global_ext = 0
let g:vimwiki_dir_link = 'README'
let g:vimwiki_list = [{'path': '~/vimwiki/',
\ 'syntax': 'markdown', 'ext': '.md'}]
" ]]]
" ]]]
" 显示插件[[[2
" rainbow_parentheses [[[3
" 不加入这行, 防止黑色括号出现, 很难识别
" \ ['black', 'SeaGreen3'],
let g:rbpt_colorpairs = [
\ ['brown', 'RoyalBlue3'],
\ ['Darkblue', 'SeaGreen3'],
\ ['darkgray', 'DarkOrchid3'],
\ ['darkgreen', 'firebrick3'],
\ ['darkcyan', 'RoyalBlue3'],
\ ['darkred', 'SeaGreen3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['brown', 'firebrick3'],
\ ['gray', 'RoyalBlue3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['Darkblue', 'firebrick3'],
\ ['darkgreen', 'RoyalBlue3'],
\ ['darkcyan', 'SeaGreen3'],
\ ['darkred', 'DarkOrchid3'],
\ ['red', 'firebrick3'],
\ ]
let g:rbpt_max = 16
let g:rbpt_loadcmd_toggle = 0
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
" ]]]
" solarized [[[3
let g:solarized_termtrans=1
let g:solarized_contrast="normal"
let g:solarized_visibility="normal"
" ]]]
" ]]]
" 导航插件[[[2
" nerdtree nerdtreetabs [[[3
function! ChangeDirIntoCurrentBuffer()
cd %:p:h
NERDTreeCWD
endfunction
noremap <F3> :NERDTreeToggle<CR>
noremap <leader>o :call ChangeDirIntoCurrentBuffer()<CR>
let NERDTreeHighlightCursorline=1
" 自动删除掉通过NERDTree删除的文件的Buffer
let NERDTreeAutoDeleteBuffer=1
" 设置NERDTree要忽略的文件
let NERDTreeIgnore=[ '__pycache__$[[dir]]', 'node_modules$', '\.pyc$', '\.pyo$', '\.obj$', '\.o$', '\.so$', '\.egg$', '^\.git$', '^\.svn$', '^\.hg$', '^venv$' ]
"close vim if the only window left open is a NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | end
" s/v 分屏打开文件
let g:NERDTreeMapOpenSplit = 's'
let g:NERDTreeMapOpenVSplit = 'v'
" nerdtreetabs
" 关闭同步
" let g:nerdtree_tabs_synchronize_view=0
" let g:nerdtree_tabs_synchronize_focus=0
" 是否自动开启nerdtree
let g:nerdtree_tabs_open_on_console_startup=0
let g:nerdtree_tabs_open_on_gui_startup=0
" ]]]
" tagbar [[[3
nmap <F8> :TagbarToggle<CR>
let g:tagbar_width = 54
let g:tagbar_sort = 0
let g:tagbar_indent = 1
let g:tagbar_compact = 1
let g:tagbar_silent = 1
let g:tagbar_iconchars = ['▸', '▾']
" for markdown
let g:tagbar_type_markdown = {
\ 'ctagstype': 'markdown',
\ 'ctagsbin' : '/Users/michaeltsui/bin/markdown2ctags.py',
\ 'ctagsargs' : '-f - --sort=yes',
\ 'kinds' : [
\ 's:sections',
\ 'i:images'
\ ],
\ 'sro' : '|',
\ 'kind2scope' : {
\ 's' : 'section',
\ },
\ 'sort': 0,
\ }
" go语言的tagbar配置
" 1. install gotags 'go get -u github.com/jstemmer/gotags'
" 2. make sure `gotags` in you shell PATH, you can call check it with `which gotags`
" for gotags. work with tagbar
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'
\ }
" ]]]
" ]]]
" 语言相关[[[2
" pythonsyntax [[[3
let python_highlight_all = 1
" ]]]
" ]]]
" ]]]
" vim:fdm=marker:fmr=[[[,]]]
" vim:foldlevel=99