set nocompatible ” 使用vi默认模式。禁用VI一致性,可避免引入vim老版本的bug
set ls=2 ” 始终显示状态栏
set tabstop=4 ” 设置一个tab等于4个空格的宽度
set shiftwidth=4 ” 自动缩进的tab宽度
set scrolloff=3 ” 在滚动过程中,保持向下显示三行
set showcmd ” display incomplete commands
set hlsearch ” 高亮搜索结果
set incsearch ” do incremental searching
set ruler ” 显示当前光标位置
set nobackup ” 禁止创建备份文件
set number ” 显示行号
set ignorecase ” 搜索时忽略大小写 “set noignorecase ” 则为不忽略大小写
set ttyfast ” smoother changes
“set ttyscroll=0 ” turn off scrolling, didn’t work well with PuTTY
set whichwrap=b,s,h,l,<,>,[,] ” move freely between files
“set viminfo=’20,<50,s10,h“set autoindent
“set smartindent ” smart indent
“set cindent ” cindent
set autoindent “自动缩进
set smartindent “智能缩进syntax on “语法高亮开启
if has(“gui_running”)
” See ~/.gvimrc
set guifont=Monospace\ 10 ” 使用Monospace字体,10号
set lines=50 ” gui高度为50行
set columns=100 ” width = 100列
set background=light “背景颜色设置
endif
if has(“autocmd”)
” Restore cursor position
au BufReadPost * if line(“‘\””) > 0|if line(“‘\””) <= line(“$”)|exe(“norm ‘\””)|else|exe “norm $”|endif|endif
” Filetypes (au = autocmd)
au FileType helpfile set nonumber ” no line numbers when viewing help
au FileType helpfile nnoremap <buffer><cr> <c-]> ” Enter selects subject
au FileType helpfile nnoremap <buffer><bs> <c-T> ” Backspace to go back
” When using mutt, text width=72
au FileType mail,tex set textwidth=72
au FileType cpp,c,java,sh,pl,php,asp set autoindent
au FileType cpp,c,java,sh,pl,php,asp set smartindent
au FileType cpp,c,java,sh,pl,php,asp set cindent
“au BufRead mutt*[0-9] set tw=72
” Automatically chmod +x Shell and Perl scripts
“au BufWritePost *.sh !chmod +x %
“au BufWritePost *.pl !chmod +x %
” File formats
au BufNewFile,BufRead *.pls set syntax=dosini
au BufNewFile,BufRead modprobe.conf set syntax=modconf
endif
” Keyboard mappings
map <F1> :previous<CR> ” map F1 to open previous buffer
map <F2> :next<CR> ” map F2 to open next buffer
map <silent> <C-N> :silent noh<CR> ” turn off highlighted search
map ,v :sp ~/.vimrc<cr> ” edit my .vimrc file in a split
map ,e :e ~/.vimrc<cr> ” edit my .vimrc file
map ,u :source ~/.vimrc<cr> ” update the system settings from my vimrc file
“—– write out html file
map ,h :source $VIM/vim71/syntax/2html.vim<cr>:w<cr>:clo<cr>
” Common command line typos
“cmap W w
“cmap Q q
” Keyboard mapping for numeric keypad
“imap <Esc>OM <c-m>
” map <Esc>OM <c-m>
“imap <Esc>OP <nop>
” map <Esc>OP <nop>
“imap <Esc>OQ /
” map <Esc>OQ /
“imap <Esc>OR *
” map <Esc>OR *
“imap <Esc>OS –
” map <Esc>OS –
“imap <Esc>Ol +
“imap <Esc>Om –
“imap <Esc>On ,
“imap <Esc>Op 0
“imap <Esc>Oq 1
“imap <Esc>Or 2
“imap <Esc>Os 3
“imap <Esc>Ot 4
“imap <Esc>Ou 5
“imap <Esc>Ov 6
“imap <Esc>Ow 7
“imap <Esc>Ox 8
“imap <Esc>Oy 9
“imap <Esc>Oz 0
‘C相关
set nocindent