-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_vimrc_dev
More file actions
697 lines (623 loc) · 25.4 KB
/
Copy path_vimrc_dev
File metadata and controls
697 lines (623 loc) · 25.4 KB
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
" Specify a directory for plugins
" - Avoid using standard Vim directory names like 'plugin'
if has("win32")
call plug#begin('D:/vimfiles/bundle')
else
call plug#begin('~/.vim/bundle')
endif
"Make sure you use single quotes
"######### 1. VIM-相关 #########
"VIM中文文档(还集成了些常用的插件的中文文档!) Plug 'asins/vimcdoc'
Plug 'yianwillis/vimcdoc'
"最小空间占用的缓冲区列表 Plug 'fholgado/minibufexpl.vim'
"缓冲区列表增强 Plug 'bufexplorer.zip'
"分组式缓冲区列表 Plug 'TinyBufferExplorer'
"窗口布局管理器(自己配映射就用不着了,它自带了file和tag的explorer) "Plug 'winmanager'
"<C-w>o变成最大化窗或还原布局, 太慢了. Plug 'ZoomWin','regedarek/ZoomWin'
"让html标签或endif支持%, vim --startuptime /tmp/log 显示已加载自带的了
"Plug 'vim-scripts/matchit.zip'
Plug 'andymass/vim-matchup'
"operation+motion:(vim内置)
"ci,di,yi,ca,da,ya接符号及dib,diB,cit为 删除(/复制)符号内的文本
"操作对象增强: ds"为删除", cs"'为由"替换成', ys+{motion}+符号为加符号
"可视模式(选中文本后)按S"为用"surround文本
Plug 'tpope/vim-surround'
"括号自动闭合 Plug 'kien/rainbow_parentheses.vim' 'jiangmiao/auto-pairs' 'kana/vim-smartinput' 'Townk/vim-autoclose'
"<s-tab>跳出闭合,i_<C-g>g跳出最外一层,不支持<C-h>挺好
Plug 'Raimondi/delimitMate'
"enable repeating supported plugin maps with "."
Plug 'tpope/vim-repeat'
Plug 'easymotion/vim-easymotion'
"目录浏览增强, 内置为netrw
Plug 'scrooloose/nerdtree'
"显示vim的marks
Plug 'kshenoy/vim-signature'
"状态行增强 Plug 'Lokaltog/powerline', 'bling/vim-airline'
Plug 'itchyny/lightline.vim'
"precision color scheme, 'altercation/solarized' is all in one.
Plug 'altercation/vim-colors-solarized'
if !has("win32")
"让fcitx响应vim的模式切换
Plug 'lilydjwg/fcitx.vim'
endif
"The plugin is a front for ag(the_silver_searcher) Plug 'rking/ag.vim'
"字符串查找, 通过配置可以使用ag搜索
Plug 'mileszs/ack.vim'
"command-T增强,模糊查找文件 Plug 'kien/ctrlp.vim'
"vim8, 异步, 文件搜索及显示函数列表, ctrlp增强
Plug 'Yggdroot/LeaderF'
"shell模式 Plug 'Flolagale/conque'
" vimshell依赖vimproc Plug 'Shougo/vimshell.vim' | Plug 'Shougo/vimproc.vim'
"集成接口, 功能像ctrlp, 但可搜索显示任意来源的信息, 且可自定义来源 Plug 'Shougo/unite.vim'
"vim8, 异步, 后台运行 某程序
Plug 'skywind3000/asyncrun.vim'
"######### 1. VIM-相关 END #########
"######### 2. 编程-相关 #########
"文本排版
Plug 'godlygeek/tabular'
"垂直缩进线 Plug 'nathanaelkane/vim-indent-guides'
Plug 'Yggdroot/indentLine'
" 参数提示
"Plug 'Shougo/echodoc.vim', { 'for': 'python' }
"preservim/tagbar是taglist增强!
"vista十分的不好用!
"Plug 'liuchengxu/vista.vim'
Plug 'preservim/tagbar'
"python all in one! Plug 'klen/python-mode'
"杀手级clang语法解析补全插件(all in one!)
"2021年 03月 27日 星期六 03:31:26 CST
"win下要用到visual studio2019编译
Plug 'ycm-core/YouCompleteMe'
"语法检查器,保存文本时才检查(即默认的主动模式) Plug 'scrooloose/syntastic'
"vim8, 异步, 实时代码检查器
Plug 'w0rp/ale'
"vim8, 异步生成ctags, ctags用于函数 静态跳转的
"for ctrl-]
Plug 'ludovicchabant/vim-gutentags'
"注释插件 Plug 'vimcn/NERD_commenter.cnx'
Plug 'preservim/nerdcommenter'
"国人写的snipMate增强,按<C-\>,很好很强大,自定义很难: Plug 'drmingdrmer/xptemplate'
"片段引擎, snipmate增强版(未自带片段)
Plug 'SirVer/ultisnips'
"snipmate和ultisnips引擎的代码片段集, utlisnips默认都会检索
Plug 'honza/vim-snippets'
"snipmate与xptemplate快键不冲突, 不支持嵌套, 直接tab, 二者已停止更新~
"Plug 'msanders/snipmate.vim' | Plug ''scrooloose/snipmate-snippets'
"Plug 'jaredly/vim-debug'
"######### 2. 编程-相关 END #########
"######### 3. PYTHON-相关 #########
"Plug 'tmhedberg/SimpylFold', { 'for': 'python' }
"没必要用for, 有文件类型判断
Plug 'fs111/pydoc.vim', { 'for': 'python' }
"解决py方法定义的括号的缩进问题 Plug 'hynek/vim-python-pep8-indent'
"text objects for Python
"Plug 'jeetsukumaran/vim-pythonsense'
"Plug 'needle-wang/ViMango'
Plug 'needle-wang/vim-jumptoview', { 'for': 'python' }
"for snipmate, 不过ultisnips默认支持
Plug 'needle-wang/bootstrap-snippets', { 'for': ['html', 'htmldjango'] }
"jinja2语法文件
"Plug 'Glench/Vim-Jinja2-Syntax'
"######### 3. PYTHON-相关 END #########
"######### 4. front-end-相关 #########
"Plug 'othree/html5.vim'
"here is ZenCoding.vim's new name
Plug 'mattn/emmet-vim', { 'for': ['html', 'htmldjango', 'css', 'jsp'] }
"Live browser editing(实时更新html浏览)
"Plug 'jaxbot/browserlink.vim', { 'for': ['html', 'htmldjango'] }
"######### 4. front-end-相关 END #########
"######### 5. JAVA-相关 #########
"JDE有单独菜单,上手难~
"Plug 'Vim-JDE'
"JAVA补全, 如方法等
"Plug 'javacomplete'
"######### 5. JAVA-相关 END #########
"######### 6. 其他-相关 #########
Plug 'tpope/vim-fugitive'
Plug 'iamcco/mathjax-support-for-mkdp', { 'for': 'markdown' }
Plug 'iamcco/markdown-preview.vim', { 'for': 'markdown' }
"shfmt命令不知道怎么安装...
"Plug 'z0mbix/vim-shfmt', { 'for': 'sh' }
"利用vundle把它下下来而已,非vim插件 Plug 'sgerrand/xfce4-terminal-colors-solarized'
"有lispbox就别老想着这东东了,巨麻烦~ Plug 'slimv.vim'
"######### 6. 其他-相关 END #########
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
"Plug 'junegunn/vim-easy-align'
" Any valid git URL is allowed
"Plug 'https://github.com/junegunn/vim-github-dashboard.git'
" Multiple Plug commands can be written in a single line using | separators
"Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" On-demand loading
"Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
"Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Using a non-master branch
"Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
" Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
"Plug 'fatih/vim-go', { 'tag': '*' }
" Plugin options
"Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
" Plugin outside ~/.vim/plugged with post-update hook
"Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
" Unmanaged plugin (manually installed and updated)
"Plug '~/my-prototype-plugin'
" Initialize plugin system
call plug#end()
" ######### VIM-相关-插件配置 #########
"------ for surround ------
nmap <silent> q<Space> ysiw<Space><Space>f<Space>gs
nmap <silent> d<Space> ds<Space><Space>gs
"为光标下的字串加单引号
nmap q; ysiw"f"
nmap q' ysiW"f"
nmap q0 ysiw)%
nmap q- ysiW)%
vmap q; S"f"
vmap q' q;
vmap q0 S)%
"------ for surround ------
"------ for delimitMate ------
"pep8-indent一定要
let delimitMate_expand_cr = 1
let delimitMate_expand_space = 1
autocmd FileType python,json inoremap ' <Plug>delimitMate"
autocmd FileType python,json inoremap " <Plug>delimitMate'
"------ for delimitMate ------
"------ for easymotion ------
let g:EasyMotion_leader_key = ','
let g:EasyMotion_startofline = 0
"------ for easymotion ------
"------ for nerdtree ------
noremap <silent> <F7> :NERDTreeToggle<CR>
nnoremap <silent> gn :NERDTreeFind<CR>
nnoremap <silent> gN :NERDTree<CR>
let NERDTreeQuitOnOpen = 1
let NERDTreeMinimalUI = 1
let NERDTreeMouseMode = 2
let NERDTreeIgnore = ['\.vim$', '\~$', '\.pyc$', '\.ttf$']
let NERDTreeNaturalSort = 1
let NERDTreeDirArrowExpandable=">"
let NERDTreeDirArrowCollapsible="v"
"最后一个窗口是nerdtree时, 关闭vim
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
"自动打开nerdtree
"autocmd VimEnter * NERDTree | wincmd l
"------ for nerdtree ------
"------ for lightline ------
let g:lightline = {
\'colorscheme': 'powerline',
\ }
"vista
"function! NearestMethodOrFunction() abort
" return get(b:, 'vista_nearest_method_or_function', '')
"endfunction
"tagbar
let g:tagbar_status_func = 'TagbarStatusFunc'
function! TagbarStatusFunc(current, sort, fname, ...) abort
return lightline#statusline(0)
endfunction
"------ for lightline ------
"------ for solarized ------
let g:solarized_termcolors = 256
let g:solarized_contrast = "high" "default value is normal
syntax enable
set background=dark
colorscheme solarized
"colorscheme desert "也不错
"set fillchars=vert:│ "设置窗口分隔符, 必须要有值, 且必须是单宽字符
"禁掉主题提供的窗口分隔线背景
highlight VertSplit ctermbg=NONE guibg=NONE
"------ for solarized ------
"------ for fcitx --------
set ttimeoutlen=200
"fcitx不支持ex模式
"------ for fcitx --------
""------ for ctrlp ------
"let g:ctrlp_regexp = 1
"let g:ctrlp_by_filename = 1
"let g:ctrlp_custom_ignore = {
"\ 'dir' : '\v[\/]\.(git|hg|svn|rvm)$' ,
"\ 'file' : '\v\.(exe|so|dll|pyc|swp)$' ,
"\ }
""------ for ctrlp ------
"------ for ack.vim ------
noremap gq :Ack!<Space>
noremap Q :Ack!<CR>
let g:ackprg = 'ag --vimgrep'
set grepprg=ag\ --vimgrep\ $*
set grepformat=%f:%l:%c:%m
"------ for ack.vim ------
"------ for ag.vim ------
"let g:ag_prg = 'ag --column'
"------ for ag.vim ------
"------ for LeaderF ------
let g:Lf_ShortcutF = '<C-p>'
noremap <C-n> :LeaderfBufTag<CR>
"noremap <C-n> :LeaderfFunction<CR>
"let g:Lf_ShortcutB = '<C-n>'
"noremap <m-n> :LeaderfMru<CR>
"noremap <C-n> :LeaderfBuffer<CR>
"noremap <m-m> :LeaderfBufTag<CR>
let g:Lf_HideHelp = 1
let g:Lf_DefaultExternalTool = "ag"
let g:Lf_StlSeparator = { 'left': '', 'right': '', 'font': '' }
let g:Lf_RootMarkers = ['.project','.root','.git','.hg','.svn']
let g:Lf_WorkingDirectoryMode = 'Ac'
let g:Lf_WindowHeight = 0.30
"与vim-gutentags联动
let g:Lf_GtagsGutentags = 1
if has("win32")
let g:Lf_CacheDirectory = expand('D:/vimfiles')
else
let g:Lf_CacheDirectory = expand('~/.vim')
endif
let g:Lf_GtagsAutoUpdate = 0
let g:Lf_ShowRelativePath = 0
let g:Lf_StlColorscheme = 'powerline'
let g:Lf_PreviewResult = {'Function':0, 'BufTag':0}
"git ls-files会列出的是octal形式的utf8, leaderf没有处理
"如: "training\345\256\214\346\210\220\345\276\214.txt"
"git config --global core.quotepath false
"let g:Lf_UseVersionControlTool = 0
let g:Lf_WildIgnore = {
\ 'dir' : ['.git','.hg','.svn'],
\ 'file' : ['*.sw?','~$*','*.bak','*.exe','*.o','*.so','*.py[co]', '*.ico']
\}
"------ for LeaderF ------
"------ for asyncrun ------
" 自动打开 quickfix window ,高度为5
let g:asyncrun_open = 5
" 任务结束时候响铃提醒, 0为关闭
let g:asyncrun_bell = 0
" asyncrun根据特殊文件名 来识别 project 的根目录
let g:asyncrun_rootmarks = ['.svn', '.git', '.root', 'build.xml']
" "<root>" 或者 "$(VIM_ROOT)" 来表示项目所在路径
"nnoremap <silent> <F5> :AsyncRun -save=1 -cwd=<root> make <CR>
nnoremap <silent> <F5> :AsyncRun -save=1 -cwd=<root> -mode=terminal -raw python3 "$(VIM_FILEPATH)"<CR>
" 设置 打开/关闭 Quickfix 窗口
nnoremap <F6> :call asyncrun#quickfix_toggle(6)<CR>
let $PYTHONUNBUFFERED=1
"------ for asyncrun ------
" ######### VIM-相关-插件配置 END -#########
" ######### 编程-相关-插件配置 #########
"------ for tabular ------
"g;和g,很有用
noremap g/ :Tab /
noremap g= :Tab /=<CR>
noremap g1 :Tab /!=<CR>
noremap g2 :Tab /==<CR>
noremap g. :Tab /,<CR>
noremap g" :Tab /"<CR>
noremap g' :Tab /'<CR>
noremap g: :Tab /:<CR>
noremap g<Space> :Tab / <CR>
"noremap g<Bar> :Tab /<Bar><CR>
"------ for tabular ------
"------ for indentLine ------
nnoremap g<Bar> :IndentLinesToggle<CR>
let g:indentLine_enabled = 1
let g:indentLine_char = '┊'
let g:indentLine_color_term = 239 " vim
" none X terminal
let g:indentLine_color_tty_light = 7
let g:indentLine_color_dark = 1
let g:indentLine_fileType = ['python']
let g:indentLine_indentLevel = 3
nnoremap g<Bar> :IndentLinesToggle<CR>
"------ for indentLine ------
""------ for echodoc.vim ------
"let g:echodoc_enable_at_startup = 1
""------ for echodoc.vim ------
"------ for tagbar ------
noremap <silent> <F8> :TagbarToggle<CR>
noremap <silent> g8 :TagbarToggle<CR>
if has("win32")
let g:tagbar_ctags_bin='D:\Python\needle-dev-bin\ctags.exe'
endif
let g:tagbar_width = 40
let g:tagbar_compact = 1 "去掉含有<F1>的首行
let g:tagbar_indent = 2 "修改tagbar内的缩进空间
let g:tagbar_singleclick = 1 "单击打开标签
let g:tagbar_autofocus = 1 "打开tagbar时自动获取焦点
"let g:tagbar_autoshowtag = 0 "自动打开折叠
let g:tagbar_sort = 0 "标签按代码中的顺序排序
let g:tagbar_scrolloff = 200 "tagbar窗口的scrolloff
let g:tagbar_jump_offset = 200 "我一直想要的, 跳转后zt!, 999会失效
"let g:tagbar_jump_lazy_scroll = 1 "好功能, 但与tagbar_jump_offset冲突
let g:tagbar_iconchars = ['>', 'v']
let g:tagbar_show_balloon= 0 "禁用popup message: 见noballooneval
set updatetime=700 "自动高亮当前tag的间隔时间,全局的
"------ for tagbar ------
"------ for vista ------
"noremap <silent> <F8> :Vista!!<CR>
"noremap <silent> g8 :Vista!!<CR>
""let g:vista_icon_indent = ["▸ ", ""]
"let g:vista_sidebar_width = 40
"let g:vista_default_executive = 'ctags'
""let g:vista_fzf_preview = ['right:50%']
"let g:vista#renderer#enable_icon = 1
"let g:vista#renderer#icons = {
"\ "function": "Ⓜ",
"\ "variable": "Ⓥ",
"\ }
"------ for vista ------
"------ for YouCompleteMe ------
"vim中, <C-m>等价于Enter(<CR>)
"跳转到定义
"nnoremap <silent> <leader>g :YcmCompleter GoTo<CR>
nnoremap <silent> go :tab YcmCompleter GoTo<CR>
autocmd FileType python nnoremap <silent> gd :tab YcmCompleter GoToDeclaration<CR>:let @/ = '\V\<'.escape(expand('<cword>'), '\').'\>'<Bar>set hls<CR>
let g:ycm_auto_hover = '' "禁用光标悬停(updatetime秒后)弹出doc
let g:ycm_seed_identifiers_with_syntax = 1 "语法关键字补全
let g:ycm_complete_in_comments = 1 "在注释中也启用补全
let g:ycm_goto_buffer_command = 'split-or-existing-window' "设定跳转命令打开方式
let g:ycm_key_list_select_completion = ['<Down>']
let g:ycm_key_list_previous_completion = ['<Up>']
let g:ycm_show_diagnostics_ui = 0
let g:ycm_collect_identifiers_from_comments_and_strings = 1
let g:ycm_log_level = 'warning'
"ycmd server使用的py版本
"let g:ycm_server_python_interpreter='python3'
"python completer使用的py版本, 忘了从哪里看到的此选项, 搜不到
"https://stackoverflow.com/questions/41650902/how-to-change-python-auto-completion-to-venv-directory-in-vim-ycm
if has("win32")
let g:ycm_python_binary_path = 'D:\Python\3_10\python3.exe'
else
let g:ycm_python_binary_path = 'python3'
endif
"let g:ycm_add_preview_to_completeopt = 1
"let g:ycm_autoclose_preview_window_after_insertion = 1
"上行无效~, 下行有效~, 老出问题
"autocmd InsertLeave * if pumvisible() == 0|pclose|endif
"YouCompleteMe对不支持语义(semantic)补全的就会使用omnifunc, 如html
"启用范围为 黑名单在白名单中的补集
let g:ycm_filetype_blacklist = {
\ 'c' : 1,
\ 'cpp' : 1,
\ 'infolog' : 1,
\ 'json' : 1,
\ 'mail' : 1,
\ 'markdown' : 1,
\ 'nerdtree' : 1,
\ 'notes' : 1,
\ 'pandoc' : 1,
\ 'qf' : 1,
\ 'tar' : 1,
\ 'tagbar' : 1,
\ 'text' : 1,
\ 'unite' : 1,
\ 'vimwiki' : 1,
\}
"let g:ycm_filetype_whitelist = {
"\ 'css' : 1,
"\ 'html' : 1,
"\ 'htmldjango' : 1,
"\ 'java' : 1,
"\ 'javascript' : 1,
"\ 'python' : 1,
"\}
"------ for YouCompleteMe ------
""------ for syntastic ------
""手动检查, 主动模式会卡一会(pylint的原因,用pyflakes就好了)
"let g:syntastic_mode_map = { 'mode' : 'passive' }
"let g:syntastic_error_symbol = 'X>'
"let g:syntastic_warning_symbol = '⚠'
"let g:syntastic_check_on_wq = 0 "退出不检查
""主动模式与python-mode冲突, 导致有两次语法检查, 要么设成被动模式
""let g:pymode_lint_write = 0 "for python-mode
""出现错误自动打开错误位置列表, 没有出现则不打开
""let g:syntastic_auto_loc_list = 1
"let g:syntastic_always_populate_loc_list = 1 "即时刷新错误位置(:Errors)列表!
"let g:syntastic_quiet_messages = {'level' : 'warnings'} "去掉警告信息
"let g:syntastic_python_checkers = ['pyflakes']
""syntastic_java_checkers与eclim有冲突
""html检查要联网, 或自己架server~
""let g:syntastic_html_checkers = ['w3']
""let g:syntastic_javascript_checkers = ['javascript']
""nnoremap gs :SyntasticCheck<CR>
"function! Syntastic_map(map_cmd1, map_cmd2)
""下行可以用\<bar> 或 \|
""nnoremap ]l :try<bar>lnext<bar>catch /^Vim\%((\a\+)\)\=:E\%(776\<bar>553\<bar>42\):/<bar>echo v:exception<bar>endtry<CR>
"try
"execute a:map_cmd1
""下行用\<bar>会无效
""catch /^Vim\%((\a\+)\)\=:E\%(776\<Bar>553\<Bar>42\):/
""E776: no location list, E553: no more error item, E42: no error
"catch /^Vim\%((\a\+)\)\=:E\%(776\|553\|42\):/
"try
"up "SyntasticCheck只能检查保存后的内容
"SyntasticCheck
"execute a:map_cmd2
"catch /.*/
"echo v:exception
"endtry
"catch
"echo v:exception
"endtry
"endfunction
"nnoremap <silent> [n :call Syntastic_map("lnext", "lfirst")<CR>
"nnoremap <silent> [N :call Syntastic_map("lprevious", "llast")<CR>
""------ for syntastic ------
"------ for ale ------
nnoremap <F2> :ALEFix<CR>
nnoremap <silent> [n :ALENextWrap<CR>
nnoremap <silent> [N :ALEPreviousWrap<CR>
let g:ale_set_balloons=0 "禁用popup message: 见noballooneval
let g:ale_completion_delay = 500
let g:ale_echo_delay = 20
let g:ale_echo_msg_format = '[%linter%] %code: %%s'
"let g:ale_fix_on_save = 1
"let g:ale_sign_column_always = 1
let g:ale_sign_error = '✗'
let g:ale_sign_warning = '⚡'
let g:ale_lint_delay = 500
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_linters_explicit = 1
"语法检查器(自动检查)
"pip3 install flake8
"apt-get install shellcheck
let g:ale_linters = {
\ 'python' : ['flake8'],
\ 'sh' : ['shellcheck'],
\ 'vim' : ['vint'],
\ 'rust' : ['cargo', 'rls'],
\}
let g:ale_python_flake8_options = '--ignore=E111,E114,E121,E128,E203,E251,E266,E501,F841,W391,W503'
"语法修复器: ALEFix
"pip3 install isort yapf
"'sh': ['shfmt'], 但是shfmt不会装...
let g:ale_fixers = {
\ 'python' : ['yapf', 'isort'],
\ 'json' : ['jq'],
\ 'rust' : ['rustfmt'],
\}
if executable("yapf3")
let g:ale_python_yapf_executable = 'yapf3'
else
let g:ale_python_yapf_executable = 'yapf'
endif
"没有这个yapf选项, 在项目的任意父目录加个.style.yapf
"let g:ale_python_yapf_options = '--style={indent_width:2}'
let g:ale_rust_rls_toolchain = 'stable'
hi! clear SpellBad
hi! clear SpellCap
hi! clear SpellRare
hi! SpellBad gui=undercurl guisp=red
hi! SpellCap gui=undercurl guisp=blue
hi! SpellRare gui=undercurl guisp=magenta
"------ for ale ------
"------ for vim-gutentags ------
"if has("win32")
" let s:vim_tags = expand('D:/vimfiles/cache/tags')
"else
" let s:vim_tags = expand('~/.vim/cache/tags')
"endif
" 检测 ~/.cache/tags 不存在就新建, 不加了, 报错再自己创建吧!
"if !isdirectory(s:vim_tags)
" silent! call mkdir(s:vim_tags, 'p')
"endif
" 将自动生成的tags文件全部放入.LfCache/gtags目录中,避免污染工程目录
"let g:gutentags_cache_dir = s:vim_tags
let g:gutentags_cache_dir = expand(g:Lf_CacheDirectory.'/.LfCache/gtags')
"http://www.skywind.me/blog/archives/2084
set tags=./.tags;,.tags "这句加跟不加没啥区别呀~
let g:gutentags_project_root = ['.root', '.svn', '.git', '.hg', '.project']
let g:gutentags_ctags_exclude = ['build', 'dist', '*css', '*json', '*yaml', '*md']
" 所生成的数据文件的名称
let g:gutentags_ctags_tagfile = '.tags'
" 配置 ctags 的参数
let g:gutentags_ctags_extra_args = ['--fields=+niazS', '--extra=+q']
let g:gutentags_ctags_extra_args += ['--c++-kinds=+px']
let g:gutentags_ctags_extra_args += ['--c-kinds=+px']
"------ for vim-gutentags ------
"------ for nerdcommenter ------
let g:NERDCreateDefaultMappings = 0
let g:NERDDefaultAlign = 'left'
let g:NERDTrimTrailingWhitespace = 1
noremap <silent> gc :call nerdcommenter#Comment("n", "comment")<CR>:up<CR>mw
noremap <silent> gC :call nerdcommenter#Comment("n", "Uncomment")<CR>:up<CR>mw
"------ for nerdcommenter ------
"------ for xptemplate ------
"let g:xptemplate_nav_prev = '<C-k>'
"------ for xptemplate ------
"------ for UltiSnips ------
let g:UltiSnipsExpandTrigger = "<tab>"
let g:UltiSnipsJumpForwardTrigger = "<tab>"
let g:UltiSnipsJumpBackwardTrigger = "<C-k>"
"------ for UltiSnips ------
" ######### 编程-相关-插件配置 END #########
" ######### PYTHON-相关-插件配置 #########
"------ for SimpylFold ------
"TODO, 怎么把折叠中的行数禁掉??
"let g:SimpylFold_docstring_preview = 1
"let g:SimpylFold_fold_import = 0
"------ for SimpylFold ------
"------ for pydoc.vim ------
let g:pydoc_cmd = 'python3 -m pydoc'
let g:pydoc_open_cmd = 'vsplit'
let g:pydoc_highlight = 0
"------ for pydoc.vim ------
"------ for vim-jumptoview ------
let g:jumptoview_patterns_prefix = ''
"------ for vim-jumptoview ------
"
"------ for bootstrap-snippets ------
"有YouCompleteMe, 不用设置就支持了
"set dictionary+=~/.vim/bundle/bootstrap-snippets/dictionary
"set complete+=k
"------ for bootstrap-snippets ------
" ######### PYTHON-相关-插件配置 END #########
" ######### front-end-相关-插件配置 #########
"------ for emmet ------
"emmet不能映射<Bar>, 会导致ultisnips失效
"不能用noremap, leaderkey会失效
"<C-/>, <C-&>, <C-_>可生成
"还有一些特殊符号可改, 具体忘了
"这跟顺序有关嘛? 在EmmetInstall后面let有影响嘛?
autocmd FileType html,htmldjango,css,jsp EmmetInstall
\| let g:user_emmet_install_global = 0
\| let g:user_emmet_leader_key = 'Q'
\| let g:user_emmet_mode = 'nv'
\| map <C-n> <Plug>(emmet-expand-abbr)
\| map <Plug>(emmet-expand-abbr)
\| imap <C-o><Plug>(emmet-expand-abbr)
"------ for emmet ------
"------ for browserlink ------
"autocmd BufWritePost *.html :BLReloadPage
"1. run: ~/.vim/bundle/browserlink.vim/browserlink/start.sh
"要装nodejs, 并: sudo ln -s /usr/bin/nodejs /usr/bin/node
"2. 在页面中加上<script src='http://127.0.0.1:9001/js/socket.js'></script>
"下行写在browserlink.js里(将在chrome里的改动 动态写回 原文件中):
"window.__BL_OVERRIDE_CACHE = true
"------ for browserlink ------
" ######### front-end-相关-插件配置 END #########
" ######### JAVA-相关-插件配置 #########
"------ for Vim-JDE" ------
"autocmd FileType java inoremap <buffer> . .<C-x><C-u>
"以这个为主(不支持"someStr".形式,编译后支持本类),javacomplete为辅
"set completefunc=VjdeCompletionFun
"let g:vjde_lib_path = "/opt/MyEclipse_10_0/Common/plugins/com.genuitec.eclipse.j2eedt.core_10.0.0.me201110301321/data/libraryset/EE_5/javaee.jar"
"let g:vjde_javadoc_path = "/opt/jdk1.6.0_38/sourcecode/"
"------ for Vim-JDE" ------
"for java, ctags就是一砣, 太差了,一点都跳不准~
"sudo ctags -R --fields=+iaS --extra=+q
"autocmd FileType java set tags=/opt/jdk1.6.0_38/sourcecode/tags
"for javacomplete
"接口变量只能补全接口的方法,无Object的
"完整包路径的对象变量的点补全
"final类的对象变量的点补全,"someStr".也支持
"不支持自定义的类~
"已经相当不错了~
"autocmd FileType java setlocal omnifunc=javacomplete#Complete
"文档说是显示参数信息,不知道怎么用~,用vjde的
"setlocal completefunc=javacomplete#CompleteParamsInfo
"for pythoncomplete
"vim自带pythoncomplete.vim, 智能启用, 但是找不到哪autocmd的~
"YouCompleteMe自带了python补全~,且与下面的点映射冲突
"有时要加<C-p>上移, 有时又不要, 不清楚~
"autocmd FileType python inoremap <buffer> . .<C-x><C-o><C-p>
"docString的预览窗口会闪屏,所以要取消preview, 设成全局的更好些
set completeopt=longest,menu
"------ for eclim ------
"很完美,就是vim版eclipse,想受虐就用.
"保存时语法检查,巨快(syntastic完全比不上~)
"eclim默认会用pyflakes和python编译器验证语法,第一次检测没有pyflakes就不再用pyflakes
"let g:EclimPythonValidate = 0 "禁用保存文件时验证,.py不需要开eclimd
"有YouCompleteMe就不需要这个映射
"autocmd FileType java inoremap <buffer> . .<C-x><C-u>
" \| nnoremap <silent> <buffer> [i :JavaImportOrganize<CR>
" \| nnoremap <silent> <buffer> [d :JavaDocPreview<CR>
" \| nnoremap <silent> <buffer> [f :%JavaFormat<CR>
" \| nnoremap <silent> <buffer> <CR> :JavaSearchContext<CR>
" \| let g:EclimJavaCompleteCaseSensitive = 1
" \| let g:EclimCompletionMethod = 'omnifunc'
"------ for eclim ------
" ######### JAVA-相关-插件配置 END #########
" ######### 其他-相关-插件配置 #########
"------ for vim-fugitive ------
nnoremap \g :Git<CR>
"------ for vim-fugitive ------
"------ for markdown-preview ------
autocmd FileType markdown nnoremap X :MarkdownPreview<CR>
"------ for markdown-preview ------
" ######### 其他-相关-插件配置 END #########