-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_vimrc
More file actions
executable file
·212 lines (164 loc) · 5.1 KB
/
_vimrc
File metadata and controls
executable file
·212 lines (164 loc) · 5.1 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
"
"@Yifeng Wang
"2015-06-28
"github:hiddaorear
"
" {{{{{
" General {{{
set nocompatible
"au BufWinEnter * silent! loadview
"au BufWinLeave * silent! mkview
"autocmd! bufwritepost .vimrc source %
"set autochdir
set whichwrap=b,s,<,>,[,]
set nobomb
set clipboard=unnamed
set winaltkeys=no
set noeb " no error bells
set ai " auto indent
set bs=2 " 在insert模式下用退格键删除
set showmatch " 设置匹配模式,例如输入左括号会匹配相应的右括号
set isk+=- " 设置-为单词的一部分
set incsearch " 关键字未输入完全即显示结果
set ignorecase " 忽略大小写
set smartcase " 如果有大写字母,则切换到大小写敏感查找
" }}}
" File {{{
set nowritebackup " only in case you don't want a backup file while editing
set noundofile " no undo files
set nobackup
set noswapfile
set autoread
set hidden " 不自动保存,切换buffer时不被打断;autowriteall,自动保存
" }}}
" Lang & Encoding {{{
set fileencodings=ucs-bom,utf-8,utf-16,gbk,big5,gb18030,latin1
set encoding=utf-8
set langmenu=en_US
let $LANG = 'en_US.UTF-8'
"language messages zh_CN.UTF-8
" }}}
" GUI {{{
colorscheme Tomorrow-Night-Bright "torte solarized molokai phd ron evening pablo desert
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
set cursorcolumn " 高亮显示光标所在的行和列
set cursorline
set hlsearch
autocmd InsertEnter * :set norelativenumber number
autocmd InsertLeave * :set relativenumber
set numberwidth=4
" 窗口大小
"set lines=35 columns=140
" 分割出来的窗口位于当前窗口下边/右边
set splitbelow
set splitright
"不显示工具/菜单栏
set guioptions-=T
set guioptions-=m
set guioptions-=L
set guioptions-=r
set guioptions-=b
" 使用内置 tab 样式而不是 gui
set guioptions-=e
set nolist
set guifont=Consolas:h12:cANSI
set go-=r " 去除左右滚动条
set go-=L
set scrolloff=8 " 光标移动到buffer顶部或底部时,保持8行的距离
set colorcolumn=85
set t_Co=256 "terminal color,因terminal的vim只支持16色,设定vim使用256色
set mouse=a " || a,非a值则使用系统的标准选取、复制,使用Ctrl+c:w
set ruler " 右下角显示状态说明,行号之类
set linespace=6 " Number of pixel lines inserted between characters.
set laststatus=2 " 总是显示状态行
set list " 列表选项,显示行尾字符($)和未扩展标签(^I),行尾空白
set listchars=tab:>-,trail:- " 未扩展标签显示为>-,行尾空白为-
set wrap " 自动换行
set cmdheight=1 " 命令行高度
" }}}
" Format {{{
set autoindent
set smartindent
set expandtab
set foldenable " 开始折叠
set foldmethod=syntax
set foldcolumn=3 " 折叠区域的宽度
set foldlevel=1 " 折叠层数
set foldlevelstart=99 " 打开文件默认不折叠
nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc':'zo')<CR> " 用空格开关折叠
set tabstop=4
set shiftwidth=4
set softtabstop=4
syn on
syntax on
" }}}
" Coding {{{
set complete+=k
set wildmenu " 命令模式下不全以菜单形式显示
set wildmode=list:longest,full "bash shell complete
" }}}
" }}}}}
" {{{{{
filetype off " required
set rtp+=$VIM/vimfiles/bundle/Vundle.vim/
let path='$VIM/Vimfiles/bundle'
call vundle#begin(path)
" alternatively, pass a path where Vundle should install plugins
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'vim-scripts/L9'
Plugin 'scrooloose/nerdtree'
Plugin 'kien/ctrlp.vim'
Plugin 'ggVGc/vim-fuzzysearch'
Plugin 'godlygeek/tabular'
call vundle#end()
filetype plugin indent on
" }}}}}
"Plugin {{{{{
" ctrlp {{{
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
map <leader>f :CtrlPMRU<CR>
let g:ctrlp_custom_ignore = '\v[\/](node_modules|target|dist)|(\.(swp|ico|git|svn))$'
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows
let g:ctrlp_working_path_mode = 'rw'
let g:ctrlp_match_window_bottom=1
let g:ctrlp_max_height=150
let g:ctrlp_match_window_reversed=0
let g:ctrlp_mruf_max=500
let g:ctrlp_follow_symlinks=1
let g:ctrlp_max_depth = 40
"let g:ctrlp_max_files = 0
let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:20,results:100'
" search by file name
let g:ctrlp_by_filename = 1
" }}}
" nerdtree {{{
autocmd VimEnter * NERDTree
let NERDTreeWinPos="right"
let NERDTreeShowBookmarks=1
let g:NERDTreeChDirMode = 2
" }}}
" FuzzySearch {{{
let g:fuzzysearch_prompt = 'fuzzy /'
let g:fuzzysearch_hlsearch = 1
let g:fuzzysearch_ignorecase = 1
let g:fuzzysearch_max_history = 30
let g:fuzzysearch_match_spaces = 0
" }}}
" }}}}}
" Function {{{{{
" Remove trailing whitespace when writing a buffer, but not for diff files.
function! RemoveTrailingWhitespace()
if &ft != "diff"
let b:curcol = col(".")
let b:curline = line(".")
silent! %s/\s\+$//
silent! %s/\(\s*\n\)\+\%$//
call cursor(b:curline, b:curcol)
endif
endfunction
autocmd BufWritePre * call RemoveTrailingWhitespace()
" }}}}}