-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc_back
442 lines (374 loc) · 12.8 KB
/
vimrc_back
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
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
" call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'junegunn/goyo.vim'
Plugin 'junegunn/limelight.vim'
Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'bling/vim-airline'
Plugin 'scrooloose/syntastic'
Plugin 'scrooloose/nerdtree'
Plugin 'Shougo/unite.vim'
Plugin 'Shougo/vimproc.vim'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'tpope/vim-surround'
Plugin 'Lokaltog/vim-easymotion'
Plugin 'majutsushi/tagbar'
Plugin 'SirVer/ultisnips'
Plugin 'scrooloose/nerdcommenter'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'therubymug/vim-pyte'
Plugin 'tpope/vim-repeat'
Plugin 'fholgado/minibufexpl.vim'
Plugin 'vim-scripts/matchit.zip'
Plugin 'junegunn/vim-easy-align'
Plugin 'sjl/gundo.vim'
Plugin 'szw/vim-ctrlspace'
Plugin 'tpope/vim-unimpaired'
Plugin 'Raimondi/delimitMate'
Plugin 'altercation/vim-colors-solarized'
Plugin 'mileszs/ack.vim'
Plugin 'rking/ag.vim'
Plugin 'L9'
Plugin 'honza/vim-snippets'
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
Plugin 'suan/vim-instant-markdown'
Plugin 'mhinz/vim-startify'
Plugin 'tpope/vim-abolish'
Plugin 'dhruvasagar/vim-table-mode'
" vim对lua的支持
" Plugin 'xolox/vim-misc'
" Plugin 'xolox/vim-lua-ftplugin'
" Plugin 'itchyny/calendar.vim'
" Plugin 'vim-scripts/luarefvim'
" Plugin 'vim-scripts/VimIM'
"Plugin 'msanders/snipmate.vim'
" Plugin 'mattn/emmet-vim'
" Plugin 'airblade/vim-gitgutter'
" Plugin 'vimim/vimim'
" vim-script验证语法插件
"Plugin 'todesking/vint-Syntastic'
" All of your Plugins must be added before the following line
call vundle#end() " required
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
"======================== Begin Settings ======================================
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <[email protected]>
" Last change: 2011 Apr 15
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
" for OpenVMS: sys$login:.vimrc
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? 'evim'
"finish
endif
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
if has("vms")
"set nobackup " do not keep a backup file, use versions instead
else
"set backup " keep a backup file
endif
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")
" Don't use Ex mode, use Q for formatting
"map Q gq
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
inoremap <C-U> <C-G>u<C-U>
noremap <Leader>ch :nohlsearch<CR>
" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse=a
endif
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
" filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=0
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
" Also don't do it when the mark is in the first line, that is the default
" position when opening a file.
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
"======================== Custom Settings =======================================
" 支持对应语言的语法折叠
let g:vimsyn_folding = 'aftlpPr'
"noremap <C-J> <C-W>j
"noremap <C-K> <C-W>k
"noremap <C-H> <C-W>h
"noremap <C-L> <C-W>l
"======================== Terminal Settings =====================================
:tnoremap <Esc> <C-\><C-n>
:tnoremap <C-h> <C-\><C-N><C-w>h
:tnoremap <C-j> <C-\><C-N><C-w>j
:tnoremap <C-k> <C-\><C-N><C-w>k
:tnoremap <C-l> <C-\><C-N><C-w>l
:inoremap <C-h> <C-\><C-N><C-w>h
:inoremap <C-j> <C-\><C-N><C-w>j
:inoremap <C-k> <C-\><C-N><C-w>k
:inoremap <C-l> <C-\><C-N><C-w>l
:nnoremap <C-h> <C-w>h
:nnoremap <C-j> <C-w>j
:nnoremap <C-k> <C-w>k
:nnoremap <C-l> <C-w>l
noremap ;y "*y
let mapleader=";"
" 开启实时搜索功能
set incsearch
" 搜索时大小写不敏感
set ignorecase
"防止特殊字符号无法显示
set ambiwidth=double
"缩进尺寸为4个空格
set sw=4
"tab宽度为4个字符
set ts=4
"编辑时将所有tab替换为空格
set et
"按一次backspace就删除4个空格
set smarttab
" 禁止显示滚动条
set guioptions-=l
set guioptions-=L
set guioptions-=r
set guioptions-=R
" 禁止显示菜单和工具条
set guioptions-=m
set guioptions-=T
" 高亮显示当前行/列
"set cursorline
"set cursorcolumn
" 基于缩进或语法进行代码折叠
"set foldmethod=indent
set foldmethod=syntax
" 启动 vim 时进行折叠代码
set foldenable
" 设置编码
set encoding=utf-8
set fileencodings=utf-8,chinese,latin-1
if has("win32")
set fileencoding=chinese
else
set fileencoding=utf-8
endif
"解决consle输出乱码
language messages zh_CN.utf-8
" 设置文件编码检测类型及支持格式
set fencs=utf-8,gbk,ucs-bom,gb18030,gb2312,cp936
" 指定菜单语言
set langmenu=zh_CN.utf-8
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
" 设置中文帮助,必须包含“+multi_lang”属性
if version >= 603
set helplang=cn
endif
if !has('nvim') && has("gui_running")
winpos 300 0
set lines=64 columns=120
endif
set nu
"set guifont=consolas:h10
set wrap
if v:version > 703 || v:version == 703 && has("patch541")
set formatoptions+=j " Delete comment character when joining commented lines
endif
"======================== Indent-guides Settings ===============================
" 色块宽度
let g:indent_guides_guide_size = 1
let g:indent_guides_auto_colors = 0
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=3
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=green ctermbg=4
"======================== Minibufexpl Settings =================================
noremap <C-TAB> :MBEbn<CR>
noremap <C-S-TAB> :MBEbp<CR>
noremap <leader>bd :MBEbd!
let g:miniBufExplCycleArround = 1
" MiniBufExpl Colors
hi MBENormal guifg=#808080 guibg=fg
hi MBEChanged guifg=#CD5907 guibg=fg
hi MBEVisibleNormal guifg=#5DC2D6 guibg=fg
hi MBEVisibleChanged guifg=#F1266F guibg=fg
hi MBEVisibleActiveNormal guifg=#A6DB29 guibg=fg
hi MBEVisibleActiveChanged guifg=#F1266F guibg=fg
"======================== Gundo Settings =======================================
" 开启保存 undo 历史功能
set undofile
" undo 历史保存路径
set undodir=$home/vimfiles/undo_history
" ===================== Tagbar Settings ======================================
" 设置显示/隐藏标签列表子窗口的快捷键。速记:tag list
nnoremap <Leader>tl :TagbarToggle<CR>
" 设置标签子窗口的宽度
" let tagbar_width=32
" tagbar 子窗口中不显示冗余帮助信息
let g:tagbar_compact=1
" 设置 ctags 对哪些代码元素生成标签
let g:tagbar_type_cpp = {
\ 'kinds' : [
\ 'd:macros:1',
\ 'g:enums',
\ 't:typedefs:0:0',
\ 'e:enumerators:0:0',
\ 'n:namespaces',
\ 'c:classes',
\ 's:structs',
\ 'u:unions',
\ 'f:functions',
\ 'm:members:0:0',
\ 'v:global:0:0',
\ 'x:external:0:0',
\ 'l:local:0:0'
\ ],
\ 'sro' : '::',
\ 'kind2scope' : {
\ 'g' : 'enum',
\ 'n' : 'namespace',
\ 'c' : 'class',
\ 's' : 'struct',
\ 'u' : 'union'
\ },
\ 'scope2kind' : {
\ 'enum' : 'g',
\ 'namespace' : 'n',
\ 'class' : 'c',
\ 'struct' : 's',
\ 'union' : 'u'
\ }
\ }
let g:tagbar_show_linenumbers = -1
let g:tagbar_expand = 1
let g:tagbar_zoomwidth = 0
"======================== Ctrlspace Settings ===================================
set hidden
"======================== Airline Settings =====================================
let g:airline_detect_paste=1
" 设置为始终显示状态栏
set laststatus=2
"======================== Nerdtree Settings ====================================
if has('gui_running')
nnoremap <leader>nt :NERDTreeToggle<CR>:call ToggleNTree()<CR>
else
nnoremap <leader>nt :NERDTreeToggle<CR>
endif
let NERDTreeShowHidden=1
let NERDTreeShowLineNumbers=1
let NERDTreeWinSize=50
let isNERDTree=0
function! ToggleNTree()
let posX=getwinposx()
if g:isNERDTree==1
let g:isNERDTree=0
execute "winpos" posX+300 0
set columns-=50
else
let g:isNERDTree=1
execute "winpos" posX-300 0
set columns+=50
endif
endfunction
"======================== Color Settings =======================================
if has('gui_running')
set background=light
else
set background=dark
endif
colorscheme solarized
"set nocolorcolumn
hi CursorColumn ctermbg=7 guibg=#ddd8d5
hi CursorLine cterm=underline guibg=#ddd8d5 guisp=#586e75
"======================== Unite Settings =======================================
call unite#filters#matcher_default#use(['matcher_fuzzy'])
nnoremap <leader>fu :<C-u>Unite -start-insert file_rec/async:!<CR>
nnoremap <leader>ff :<C-u>Unite -start-insert file<CR>
let g:unite_data_directory="~/Data/Config/vim/mac/unite"
nnoremap <leader>bmd :<C-u>Unite bookmark:memo-develop<CR>
nnoremap <leader>bmp :<C-u>Unite bookmark:private<CR>
"======================== delimitMate Settings =================================
"======================== UltiSnips Settings ===================================
let g:UltiSnipsExpandTrigger="<c-c>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
"======================== Markdown Settings ====================================
"autocmd BufNewFile,BufReadPost *.md set filetype=markdown
"set shell=bash\ -i
"======================== Syntastic Settings ===================================
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_error_symbol = "✗"
let g:syntastic_warning_symbol = "⚠"
let g:syntastic_style_error_symbol = "S✗"
let g:syntastic_style_warning_symbol = "S!"
let g:syntastic_python_flake8_args = '--max-line-length 5000'
let g:syntastic_vue_checkers = ['eslint']
noremap <leader>ln :lnext<CR>
noremap <leader>lp :lprevious<CR>
"======================== Startify Settings ====================================
let g:startify_bookmarks = [ {'v': '~/.vimrc'}, {'b': '~/.vim/bundle/'}, {'w': '~/Workspace'} ]
noremap <leader>mn :Startify<CR>
"======================== Goyo Settings ========================================
autocmd! User GoyoEnter Limelight
autocmd! User GoyoLeave Limelight!