-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvimrc
More file actions
163 lines (133 loc) · 5.91 KB
/
Copy pathvimrc
File metadata and controls
163 lines (133 loc) · 5.91 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
" Configuration file for vim
set modelines=0 " CVE-2007-2438
set hlsearch "高亮搜索
set incsearch "在输入要搜索的文字时,实时匹配
if has("syntax")
syntax on
endif
"set mouse=a " 在任何模式下启用鼠标
set t_Co=256 " 在终端启用256色
"set backspace=indent,eol,start " 设置退格键可用
set nocompatible "禁用 Vi 兼容模式
set encoding=utf-8 "设置gvim内部编码
set fileencoding=utf-8 "设置当前文件编码
set fileencodings=ucs-bom,utf-8,gbk,cp936,latin-1 "设置支持打开的文件的编码
" 文件格式,默认 ffs=dos,unix
set fileformat=unix "设置新文件的<EOL>格式
set fileformats=unix,dos,mac "给出文件的<EOL>格式类型
" :BundleList 等
" git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/vundle
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" 使用Vundle来管理Vundle,这个必须要有。
Bundle 'gmarik/vundle'
Bundle 'Chiel92/vim-autoformat'
Bundle 'majutsushi/tagbar'
"Bundle 'suan/vim-instant-markdown'
Bundle 'vim-php/tagbar-phpctags.vim'
Bundle 'michalbachowski/vim-wombat256mod'
Bundle 'shime/vim-livedown'
"Bundle 'https://github.com/bpearson/vim-phpcs/blob/master/plugin/phpcs.vim'
"Bundle 'jlanzarotta/bufexplorer'
"Bundle 'winmanager'
"Bundle 'scrooloose/nerdtree'
filetype on "启用文件类型侦测
filetype plugin on "针对不同的文件类型加载对应的插件
filetype plugin indent on "启用缩进
set smartindent "启用智能对齐方式
set noexpandtab "将Tab键转换为空格
set tabstop=4 "设置Tab键的宽度
set shiftwidth=4 "换行时自动缩进4个空格
set smarttab "指定按一次backspace就删除shiftwidth宽度的空格
set foldenable "启用折叠
set foldmethod=indent "indent 折叠方式
" set foldmethod=marker "marker 折叠方式
" 用空格键来开关折叠
nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR>
" 当文件在外部被修改,自动更新该文件
set autoread
" 常规模式下输入 cS 清除行尾空格
nmap cS :%s/\s\+$//g<cr>:noh<cr>
" 常规模式下输入 cM 清除行尾 ^M 符号
nmap cM :%s/\r$//g<cr>:noh<cr>
" 常规模式下输入 cf 自动格格式化
nmap cf :Autoformat<CR><CR>
nmap cs :CodeSniffErrorOnly<CR>
" toggle the Tagbar window
nmap tb :TagbarToggle<CR>
nmap gm :LivedownPreview<CR>
" toggle the vwindow
"nmap wm :WMToggle<CR>
set ignorecase "搜索模式里忽略大小写
set smartcase "如果搜索模式包含大写字符,不使用 'ignorecase' 选项,只有在输入搜索模式并且打开 'ignorecase' 选项时才会使用
" set noincsearch "在输入要搜索的文字时,取消实时匹配
" Ctrl + K 插入模式下光标向上移动
imap <c-k> <Up>
" Ctrl + J 插入模式下光标向下移动
imap <c-j> <Down>
" Ctrl + H 插入模式下光标向左移动
imap <c-h> <Left>
" Ctrl + L 插入模式下光标向右移动
imap <c-l> <Right>
set number "显示行号
set laststatus=2 "启用状态栏信息
set cmdheight=2 "设置命令行的高度为2,默认为1
set cursorline "突出显示当前行
" set guifont=YaHei_Consolas_Hybrid:h10 "设置字体:字号(字体名称空格用下划线代替)
set wrap "设置不自动换行
colorscheme wombat256mod "终端配色方案
set writebackup "保存文件前建立备份,保存成功后删除该备份
set nobackup "设置无备份文件
" set noswapfile "设置无临时文件
set vb t_vb= "关闭提示音
" let g:tagbar_phpctags_bin='/usr/sbin/phpctags'
let g:tagbar_ctags_bin="/usr/local/bin/ctags"
let g:tagbar_left = 0
let g:tagbar_width = 20
let g:tagbar_indent = 0
let g:tagbar_autoshowtag = 1
"let g:winManagerWidth = 20
"let g:winManagerWindowLayout='NERDTree|BufExplorer|Tagbar'
"let g:NERDTree_title = "[NERDTree]"
"function! NERDTree_Start()
" exe 'NERDTree'
"endfunction
"
"function! NERDTree_IsValid()
" return 1
"endfunction
" Don't write backup file if vim is being called by "crontab -e"
au BufWrite /private/tmp/crontab.* set nowritebackup
" Don't write backup file if vim is being called by "chpass"
au BufWrite /private/etc/pw.* set nowritebackup
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
" http://vim.wikia.com/wiki/Show_tab_number_in_your_tab_line
if exists("+showtabline")
function MyTabLine()
let s = ''
let t = tabpagenr()
let i = 1
while i <= tabpagenr('$')
let buflist = tabpagebuflist(i)
let winnr = tabpagewinnr(i)
let s .= '%' . i . 'T'
let s .= (i == t ? '%1*' : '%2*')
let s .= ' '
let s .= i . ')'
let s .= ' %*'
let s .= (i == t ? '%#TabLineSel#' : '%#TabLine#')
let file = bufname(buflist[winnr - 1])
let file = fnamemodify(file, ':p:t')
if file == ''
let file = '[No Name]'
endif
let s .= file
let i = i + 1
endwhile
let s .= '%T%#TabLineFill#%='
let s .= (tabpagenr('$') > 1 ? '%999XX' : 'X')
return s
endfunction
set stal=2
set tabline=%!MyTabLine()
endif