贴一下我的.vimrc,部分带注释
set syntax=on
set tabstop=4
set nobackup
set cindent
"有时中文会显示乱码,用一下几条命令解决
let &termencoding=&encoding
set fileencodings=utf-8,gbk
"默认缩进4个空格大小
set shiftwidth=4
"去掉边框
set go=
"设置配色,这里选择的是desert,也有其他方案,在vim中输入:color 在敲tab键可以查看
color desert
"设置背景色,每种配色有两种方案,一个light、一个dark
set background=light
"show command in status line
set showcmd
"set the helpdoc language
"if version>=603 by LGP2011年12月22日 星期四 15时47分16秒
" set helplang = cn
"endif
"set the line number
set nu
"cancel the line number
map ,n :set nu!<CR>
"taglist的插件映射键
"nnoremap <silent> <F8> :TlistToggle<CR>
"注释掉一行的快捷键函数
function MyContent()
let tmphehe=getline(".")
call setline(line("."),"/*")
call append(line(".")," *".tmphehe." by LGP".strftime("%c"))
call append(line(".")+1,"*/")
endf
map <F3> <Esc>:call MyContent()<CR><Esc>
"自定义头文件函数..........
function Mytitle()
call setline(1,"/***************************************")
call append(line("."),"作者:LGP")
call append(line(".")+1,"时间:".strftime("%c"))
call append(line(".")+2,"文件名:".expand("%"))
call append(line(".")+3,"描述:")
call append(line(".")+4,"***************************************/")
endf
map <home> <Esc>:call Mytitle()<CR><Esc>:{1}lt;Esc>o "映射为<home>键
"头文件和源文件相互切换函数.......
"映射至<F6>键
imap <F6> <Esc>:call CppToFunc()<CR>
func! CppToFunc()
"保存文件
:w
"头文件和cc文件转换
:A
endfunc
"press control+s to save
imap <C-s> <ESC>:w<CR>i<Right>
"for encode
"set fileencodings=utf-8,gb2312,gbk,gb18030
"set termencoding = utf-8
"set encoding = prc
此博文中有较详尽的vimrc配置解释:http://blog.chinaunix.net/space.php?uid=20366132&do=blog&id=1698970
另附上vim的官网:http://www.vim.org/ 上面有最全的插件和学习资料