-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc.bundles
380 lines (334 loc) · 14.8 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
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
" Install Vim-Plug
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall | source $MYVIMRC
endif
call plug#begin("$VIMHOME/plugged")
" { General
" 缩进标记条 indent-guide {
Plug 'nathanaelkane/vim-indent-guides'
" Indent_guides 显示对齐线
let g:indent_guides_enable_on_vim_startup = 1 " 默认关闭
let g:indent_guides_guide_size = 1 " 指定对齐线的尺寸
" 因为go自动会添加tab, 使用<leader>ig也可以切换
let g:indent_guides_exclude_filetypes = ['help', 'nerdtree', 'go']
map <silent> <leader>tig :IndentGuidesToggle<cr>
map <silent> <leader>tch :call SetColorColumn()<CR> " 给当前列添加标记
" }
" 快捷注释 :tComment - inherit the NERD_commenter shortkey {
" 相比其它更智能,我的配置里面快捷键inhert了nerdcommenter
Plug 'tomtom/tcomment_vim'
map <leader>ci <Plug>TComment_<Leader>__
map <leader>cm <Plug>TComment_<Leader>_b
" comments.vim 用c-c/c-x做注释
" Plug 'comments.vim'
" 用<leader>ci/cm做注释
" Plug 'scrooloose/nerdcommenter'
" NERD_commenter 注释处理插件
" let loaded_nerd_tree = 1
" let NERDSpaceDelims = 1 " 自动添加前置空格
" }
" Press + to expand the visual selection and _ to shrink it.
Plug 'terryma/vim-expand-region'
" Easily delete, change and add such surroundings in pairs.
Plug 'tpope/vim-surround'
" 按等号或者其它符号对齐
Plug 'godlygeek/tabular'
" Plug 'junegunn/vim-easy-align'
" http://www.wklken.me/posts/2015/06/07/vim-plugin-easyalign.html
" multiple cursors
Plug 'mg979/vim-visual-multi', {'branch': 'master'}
" automatically add the closing quote, bracket
" TODO: 修复 ` 按三次的问题再开启
" Plug 'Raimondi/delimitMate'
" Plug 'Townk/vim-autoclose'
" }
" 调用外部命令格式化代码 {
Plug 'Chiel92/vim-autoformat'
" json
" npm i -g fixjson
" javascript
" npm i -g eslint
let g:formatdef_eslint = '"SRC=eslint-temp-${RANDOM}.js; cat - >$SRC; eslint --fix $SRC >/dev/null 2>&1; cat $SRC | perl -pe \"chomp if eof\"; rm -f $SRC"'
let g:formatters_javascript = ['eslint']
noremap <leader><s-f> :Autoformat<CR>:w<CR>
" 预备环境
" npm install -g eslint eslint-plugin-standard eslint-plugin-promise eslint-config-standard
" 将标准输入写到临时文件eslint-temp-xxx.js
" 调用 eslint --fix 来修复它
" 将 eslint-temp-xxx.js 输出到标准输出。
" 截掉文件尾的换行(\n)
" 删掉临时文件
" Trick 解释:
" 临时文件放在当前目录而非/tmp。否则 eslint 会根据 /tmp/eslint-temp-xxx.js 路径来读取配置文件。
" 临时文件不命名为隐藏文件。否则 eslint 会忽略它。
" 干掉文件尾的换行。这是因为 Vim 读入文件尾的换行后,会再来一个换行产生两个\n。
" http://harttle.com/2017/03/12/vim-eslint.html
" Python
" pip install autopep8
" }
" 代码补全 & snippets {
if !exists("g:no_compile_plugin")
Plug 'jayli/vim-easycomplete'
noremap gr :EasyCompleteReference<CR>
noremap gd :EasyCompleteGotoDefinition<CR>
noremap rn :EasyCompleteRename<CR>
noremap gb :BackToOriginalBuffer<CR>
" 快捷键冲突,自定义快捷键
let g:easycomplete_lsp_checking=0
nnoremap <silent> <C-k>k :EasyCompleteNextDiagnostic<CR>
nnoremap <silent> <C-k>j :EasyCompletePreviousDiagnostic<CR>
endif
Plug 'SirVer/ultisnips'
" 用 <tab> 在 macOS 会冲突
let g:UltiSnipsExpandTrigger="<c-y><c-y>"
" For conceal markers.
" if has('conceal')
" set conceallevel=2 concealcursor=niv
" endif
" }
" { Color Schemes & Highlight
" 部分语言的配色会在 Language Section
" 比较全的 color scheme
Plug 'flazz/vim-colorschemes'
" Plug 'skammer/vim-css-color'
Plug 'lilydjwg/colorizer' " 这个是vimcsscolor的替代
" 配置高亮括号,给原来的括号加上高亮
" Plug 'kien/rainbow_parentheses.vim'
let g:rbpt_colorpairs = [
\ ['brown', 'RoyalBlue3'],
\ ['Darkblue', 'SeaGreen3'],
\ ['darkgray', 'DarkOrchid3'],
\ ['darkgreen', 'firebrick3'],
\ ['darkcyan', 'RoyalBlue3'],
\ ['darkred', 'SeaGreen3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['brown', 'firebrick3'],
\ ['gray', 'RoyalBlue3'],
\ ['black', 'SeaGreen3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['Darkblue', 'firebrick3'],
\ ['darkgreen', 'RoyalBlue3'],
\ ['darkcyan', 'SeaGreen3'],
\ ['darkred', 'DarkOrchid3'],
\ ['red', 'firebrick3'],
\ ]
let g:rbpt_max = 16
let g:rbpt_loadcmd_toggle = 0
" }
" { Browsing & Navigating file
" NERDTree - FileList {
" 文件管理器
Plug 'scrooloose/nerdtree'
map <leader>wf :NERDTreeToggle<CR>
" e to open file and close the quickfix window
" o to open (same as enter)
" go to preview file (open but maintain focus on ag.vim results)
let g:NERDTreeMapToggleZoom = 'a'
let g:NERDTreeMapToggleHidden = 'h'
let g:NERDTreeWinSize = 18
let NERDTreeQuitOnOpen = 1
let NERDChristmasTree=1
let NERDTreeIgnore = ['\.pyc$','\.sock$', '\~$', '\#.*#$'] " ignore displap file
let NERDTreeMinimalUI=0 " 不显示项目树上额外的信息,例如帮助、提示
" autocmd VimEnter * NERDTree " auto start nerdtree
" autocmd vimenter * if !argc() | NERDTree | endif " if not file start too
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif " when no file colse nerdtree
" 布局管理器,让各个窗口按照规则排列
" Plug 'winmanager'
" }
"Tlist - 调用TagList {
" 需安装 ctags
if !exists("g:no_compile_plugin")
Plug 'vim-scripts/taglist.vim'
endif
" tagbar is like the taglist
Plug 'majutsushi/tagbar'
let Tlist_Show_One_File = 1 " 只显示当前文件的tags
let Tlist_Exit_OnlyWindow = 1 " 如果Taglist窗口是最后一个窗口则退出Vim
let Tlist_Use_Right_Window = 1 " 在右侧窗口中显示
let Tlist_File_Fold_Auto_Close = 1 " 自动折叠
" \wt 打开Taglist/TxtBrowser窗口,在右侧栏显示
nmap <leader>wt :Tlist<CR><c-l> " TlistToggle<CR>
" }
" CtrlP - 快速打开文件 {
Plug 'ctrlpvim/ctrlp.vim'
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'
" nnoremap <Leader>t :CtrlP getcwd()<CR>
" nnoremap <Leader>f :CtrlPClearAllCaches<CR>
" nnoremap <Leader>j :CtrlP ~/<CR>
nnoremap <Leader><space> :CtrlPBuffer<CR>
" \ff 打开文件搜索窗口,在状态栏显示
nmap <leader>ff :CtrlP<CR>
" let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
let g:ctrlp_custom_ignore = {
\'dir': '\.git$\|\.hg$\|\.svn$\|bower_components$\|dist$\|node_modules$\|project_files$\|test$',
\'file': '\.exe$\|\.so$\|\.dll$\|\.pyc$\|\.pyo$\|\.rbc$\|\.rbo$\|\.class$\|\.o$\|\~$' }
" }
" Find & Search {
" 操作
if v:version > 703
" 快速移动
" 替换原来的查找,可以同时显示多个查找关键字(Easymotion)
Plug 'Lokaltog/vim-easymotion'
map / <Plug>(easymotion-sn)
omap / <Plug>(easymotion-tn)
endif
" Plug 'justinmk/vim-sneak'
" label-mode for a minimalist alternative to EasyMotion
" let g:sneak#label = 1
" brew install fzf
" PlugInstall and PlugUpdate will clone fzf in ~/.fzf and run the install script
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
" }
" 在()、""、甚至HTML标签之间快速跳转;
" 如果是语法上的识别,在 Language Section 中添加
Plug 'vim-scripts/matchit.zip'
" 列出当前buffer列表的窗口,可以同过lru等排序快速找到文件
" Plug 'bufexplorer.zip'
" 智能打开浏览器
Plug 'tyru/open-browser.vim'
" Open URI under cursor or search.--go brower
nmap gb <Plug>(openbrowser-smart-search)
" Open URI selected word or search.
vmap gb <Plug>(openbrowser-smart-search)
" Open URI you also can use <leader>gb because of "textbrowser.vim"
" }
" { Language Special
" { Front End
" zen emmet {
" Plug 'ZenCoding.vim' " original zen coding
Plug 'mattn/emmet-vim'
"set zen coding
" let g:user_zen_settings = {
" \ 'php' : {
" \ 'extends' : 'html',
" \ 'filters' : 'c',
" \ },
" \ 'xml' : {
" \ 'extends' : 'html',
" \ },
" \ 'haml' : {
" \ 'extends' : 'html',
" \ },
" \ 'erb' : {
" \ 'extends' : 'html',
" \ },
" \}
" emmet(zen coding) 介绍
" 是横扫各大小编辑器的快速编码插件,其使用类`CSS`选择器的语法实现扩展性编码,确实够酷、够快
" `Zen Coding`在`Vim`下的默认触发键是`Ctrl + Y + ,`(注意,最后还有一个逗号)
"
" 调用规则
" ```
" `1`、单个元素:`div`
" `2`、带`id`的元素,使用`#`号:`div#name`
" `3`、带`class`的元素,使用点号(`.`):`div.header`
" `4`、`id`与`class`是可以同时使用的,如果`class`名中含多个单词,可以使用点号(`.`)进行连接:`div#name.header.one`
" `5`、子元素使用大于号(`>`),子元素的子元素可以连写:`div>p>h1`
" `6`、同级兄弟元素使用加号(`+`),可以使用括号避免歧义:`div>p>(h1+h2)`
" `7`、多项相同的元素,使用星号(`*`):`ul>li*5`
" `8`、带有序号的元素,使用美元符(`$`),从`1`开始自动递增:`div>p#id$*5`
" `9`、如果需要指定序号的位数,只须多写几个美元符(`$`)即可:`div>p#id$$$*5`
" div>p#foo$*3>a
" ```
"
" 常用缩写
" ```
" html:4t 传统的`HTML4.01`模板
" html:5 `HTML5`模板
" style 样式标签
" script 脚本标签
" link `link`标签
" a 链接标签
" ```
" 更多用法可以查看 ":help emmet"
" 或者 `gf` https://raw.githubusercontent.com/mattn/emmet-vim/master/TUTORIAL
"
" ref:
" 本文修改于: https://github.com/ruchee/backup2/blob/master/code/linux/vim/zencoding.wiki
"}
" Generate function comment
Plug 'heavenshell/vim-jsdoc'
" Front End
Plug 'pangloss/vim-javascript' " syntax HTML/JS混排缩进改善
Plug 'isRuslan/vim-es6'
" node 补全 require 或者 定位到 require 中的文件
Plug 'moll/vim-node'
Plug 'leafgarland/typescript-vim'
" support css word with -
" set iskeyword+=-
" }
" Plain text brower(show the document map and syntax highlight in plain text) {
Plug 'vim-scripts/TxtBrowser'
" :help txt-keywords@cn
" 对txt文件列目录 dep:taglist.vim
" 以空格打头, 后跟关键字"figure"的行定义为"文本图",该行将被列在taglist窗口中.
" 以空格打头, 后跟关键字"table"的行定义为"文本表",该行将被列在taglist窗口中.
" map <silent> <leader>bft :set ft=txt<cr>
" map <silent> <leader>bgu :TxtBrowserUrl<cr><cr> " 打开URL
" map <silent> <leader>bgw :TxtBrowserWord<cr><cr> " 查单词
" map <silent> <leader>bgs :TxtBrowserSearch<cr><cr> " search word under cursor
let tlist_txt_settings = 'txt;c:content;f:figures;t:tables'
let TxtBrowser_Dict_Url='http://dict.cn/text' "英文词典
" let Txtbrowser_Search_Engine='http://www.baidu.com/s?wd=text&oq=text&f=3&rsp=2'
au BufRead,BufNewFile *.txt setlocal ft=txt "syntax hlg txt for txt.vim
au BufRead,BufNewFile *log setlocal ft=txt "syntax hlg log for txt.vim
au BufRead,BufNewFile readme setlocal ft=txt "syntax hlg log for txt.vim
au BufRead,BufNewFile README setlocal ft=txt "syntax hlg log for txt.vim
au BufRead,BufNewFile INSTALL setlocal ft=txt "syntax hlg log for txt.vim
au BufRead,BufNewFile *.tag setlocal ft=txt
" au BufRead,BufNewFile ReadMe setlocal ft=txt "syntax hlg log for txt.vim
" au FileType rd setlocal ft=txt "syntax hlg readme for txt.vim
" au BufRead,BufNewFile diCtTmp setlocal ft=txt
" au BufRead,BufNewFile *.sed.in setlocal ft=txt
" au BufRead,BufNewFile *.sed.out setlocal ft=txt
" }
" Markdown {
" 集成了md的语法和颜色配置,里面的toc功能不可用
" Plug 'plasticboy/vim-markdown'
Plug 'preservim/vim-markdown'
" 设置md文件是否用自己的方式折叠
" let g:vim_markdown_folding_disabled = 1
" Change fold style to pythonic
" let g:vim_markdown_folding_style_pythonic = 1
" Disable math conceal with LaTeX math syntax enabled, add the following to your .vimrc:
let g:tex_conceal = ""
let g:vim_markdown_math = 1
" 代码块的语法声明
let g:vim_markdown_fenced_languages = ['js=javascript, bash=sh']
" ```js
" content
" ```
" 与 instant 配合使用 https://github.com/yantze/instant-markdown-d
Plug 'suan/vim-instant-markdown'
" }
" python {
" Plug 'fs111/pydoc.vim'
Plug 'vim-scripts/python.vim'
" 检查python的代码错误,编译需要'+python'
" Plug 'pyflakes.vim'
" }
" Lisp {
Plug 'kovisoft/slimv'
let g:slimv_swank_cmd = '!osascript -e "tell application \"Terminal\" to do script \"sbcl --load ~/.vim/slime/start-swank.lisp\""'
" }
" Rust {
Plug 'rust-lang/rust.vim'
" }
" Go {
" if !exists("g:no_compile_plugin")
" Plug 'fatih/vim-go'
" endif
" }
" { AppleScript
" highlighting for applescript
Plug 'dearrrfish/vim-applescript'
" }
" }
call plug#end()
" vim: set ts=4 sw=4 tw=0 et fdm=marker foldmarker={,} foldlevel=0 foldenable foldlevelstart=99 :