-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_vimrc
235 lines (195 loc) · 5.59 KB
/
_vimrc
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
""""""""""""""""""""""SYS CONFIG""""""""""""""""""""
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let eq = ''
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
let cmd = '""' . $VIMRUNTIME . '\diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
" 设置菜单语言
set langmenu=zh_cn
" =====================
" 多语言环境
" 默认为 UTF-8 编码
" =====================
if has("multi_byte")
set encoding=utf-8
" English messages only
"language messages zh_CN.utf-8
if has('win32')
language english
let &termencoding=&encoding
endif
set fencs=utf-8,gbk,chinese,latin1
set formatoptions+=mM
set nobomb " 不使用 Unicode 签名
if v:lang =~? '^\(zh\)\|\(ja\)\|\(ko\)'
set ambiwidth=double
endif
else
echoerr "Sorry, this version of (g)vim was not compiled with +multi_byte"
endif
""""""""""""""""""""""VUNDLE PLUGIN""""""""""""""""""""
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 'VundleVim/Vundle.vim'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'L9'
Plugin 'danro/rename.vim'
Plugin 'pbrisbin/vim-mkdir'
Plugin 'kien/ctrlp.vim'
Plugin 'bling/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'majutsushi/tagbar'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/nerdcommenter'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-fugitive'
Plugin 'tComment'
Plugin 'scrooloose/syntastic'
Plugin 'snipMate'
Plugin 'elzr/vim-json'
Plugin 'mattn/emmet-vim'
" Plugin 'davidhalter/jedi-vim'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
filetype plugin on
" 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
""""""""""""""""""""""VIM CONFIG""""""""""""""""""""
" 自动语法高亮
syntax on
syntax enable
" 设置tab键为4个空格
set tabstop=4
set softtabstop=4
set shiftwidth=4
set smarttab
set expandtab
" 缩进
set autoindent
set smartindent
" 设置匹配模式,如括号等
set showmatch
" 自动切换当前目录为当前文件所在的目录
set autochdir
" 设置为nocompatible模式
set nocompatible
" 搜索
set ignorecase
set incsearch " 输入搜索内容时就显示搜索结果
set hlsearch "搜索时高亮显示被找到的文本
" 代码折叠方式
set foldmethod=marker
" 文件修改后自动重新读入
set autoread
" 取消备份
set nobackup
set noswapfile
" 允许使用鼠标
set mouse=a
" 主题配置
colorscheme desert
" 行号和标尺
set nu
set ruler
set tw=100
" 状态栏配置
set laststatus=2
set showcmd " 状态栏显示目前所执行的指令
" 光标设置
" set cursorline
" set cursorcolumn
" 隐藏菜单栏和工具栏
set guioptions-=m
set guioptions-=T
""""""""""""""""""""""KEY BINDING""""""""""""""""""""
" 映射切换buffer的键位
nnoremap [b :bp<CR>
nnoremap ]b :bn<CR>
" 映射切换tab的键位
nnoremap [t :tabp<CR>
nnoremap ]t :tabn<CR>
""""""""""""""""""""""PLUGIN CONFIG""""""""""""""""""""
" airline
" 设置consolas字体"
set guifont=Consolas\ for\ Powerline\ FixedD:h10
"设置状态栏符号显示,下面编码用双引号"
let g:airline_theme="luna"
let g:Powerline_symbols="fancy"
let g:airline_symbols = {}
let g:airline_left_sep = "\u2b80"
let g:airline_left_alt_sep = "\u2b81"
let g:airline_right_sep = "\u2b82"
let g:airline_right_alt_sep = "\u2b83"
let g:airline_symbols.branch = "\u2b60"
let g:airline_symbols.readonly = "\u2b64"
let g:airline_symbols.linenr = "\u2b61"
"设置顶部tabline栏符号显示"
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
let g:airline#extensions#tabline#left_sep = "\u2b80"
let g:airline#extensions#tabline#left_alt_sep = "\u2b81"
" tagbar
nmap <F8> :TagbarToggle<CR>
" CtrlP
let g:ctrlp_show_hidden = 1
let g:ctrlp_map = '<C-p>'
let g:ctrlp_cmd = 'CtrlPMixed'
" syntastic
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
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_ignore_files = [".*\.css$"]
" Emmet
let g:user_emmet_expandabbr_key = '<C-e>'
" Enable just for html/css
let g:user_emmet_install_global = 0
autocmd FileType html,css EmmetInstall
" jedi
" autocmd FileType python setlocal completeopt-=preview
" let g:jedi#completions_command = "<C-n>"