vimrc实例源码介绍,使用具体的方法是什么?
“===============================================================================
” Filename: /root/.vimrc
” Author: xc
” Email:
” Homepage:
” Created: 2012-10-26
“===============================================================================
set encoding=gb2312
“set guifont=Luxi/ Mono/ 9 ” 设置字体,字体名称和字号
set tabstop=4 ” 设置tab键的宽度
set backspace=2 ” 设置退格键可用
set nu! ” 显示行号
“set vbt_vb= ” vim进行编辑时,如果命令错误,会发出一个响声,该设置去掉响声
“set wrap ” 自动换行
“set nowrap ” 不自动换行
set linebreak ” 整词换行
set whichwrap=b,s,<,>,[,] ” 光标从行首和行末时可以跳到另一行去
“set list ” 显示制表符
“set listchars = tab:>-,trail:- ” 将制表符显示为’>—’,将行尾空格显示为’-'
“set listchars=tab:./ ,trail:. ” 将制表符显示为’. ’
set autochdir ” 自动设置目录为正在编辑的文件所在的目录
set hidden ” 没有保存的缓冲区可以自动被隐藏
set scrolloff=5
“set softtabstop=4
“——————————————————————————–
” 查找/替换相关的设置
“——————————————————————————–
set hlsearch ” 高亮显示搜索结果
set incsearch ” 查询时非常方便,如要查找book单词,当输入到/b时,会自动找到
set gdefault ” 替换时所有的行内匹配都被替换,而不是只有第一个
“——————————————————————————–
” 状态栏相关的设置
“——————————————————————————–
set statusline=[%F]%y%r%m%*%=[Line:%l/%L,Column:%c][%p%%]
set laststatus=2 ” always show the status line
set ruler ” 在编辑过程中,在右下角显示光标位置的状态行
“——————————————————————————–
” 编程相关的设置
“——————————————————————————–
set completeopt=longest,menu ” 关掉智能补全时的预览窗口
filetype pluginindenton ” 加了这句才可以用智能补全
:set tags=/home/nfs/microwindows/src/tags
syn on ” 打开语法高亮
set showmatch ” 设置匹配模式,类似当输入一个左括号时会匹配相应的那个右括号
set smartindent ” 智能对齐方式
set shiftwidth=4 ” 换行时行间交错使用4个空格
set autoindent ” 自动对齐
set ai! ” 设置自动缩进
“colorscheme desert_xc
“——————————————————————————–
” 代码折叠
“——————————————————————————–
“set foldmarker={,}
“set foldmethod=marker
set foldmethod=syntax
set foldlevel=100 ” Don’t autofold anything (but I can still fold manually)
“set foldopen-=search ” don’t open folds when you search into them
“set foldopen-=undo ” don’t open folds when you undo stuff
“set foldcolumn=4
“——————————————————————————–
” 模仿MS Windows中的快捷键
“——————————————————————————–
vmap “yy
vmap “yd
nmap “yp
vmap “yp
nmap ggvG$
“——————————————————————————–
” 窗口操作的快捷键
“——————————————————————————–
nmap wv v ” 垂直分割当前窗口
nmap wc c ” 关闭当前窗口
nmap ws s ” 水平分割当前窗口
“——————————————————————————–
” 模仿MS Windows中的保存命令: Ctrl+S
“——————————————————————————–
imap :wai
nmap :wa
“###############################################################################
” The following is the Plugins’ setting
“###############################################################################
“——————————————————————————–
” TagList :Tlist
“——————————————————————————–
let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow = 1
“let Tlist_Use_Right_Window=1
“——————————————————————————–
” netrw 文件浏览器 :e
“——————————————————————————–
“let g:netrw_winsize = 30 ” 浏览器宽度
“——————————————————————————–
” QuickFix
“——————————————————————————–
nmap :cn ” 切换到下一个结果
nmap :cp ” 切换到上一个结果
“——————————————————————————–
” WinManager :WMToggle
“——————————————————————————–
let g:winManagerWindowLayout=’FileExplorer|TagList’
“let g:winManagerWidth = 30
“let g:defaultExplorer = 0
“nmap :BottomExplorerWindow ” 切换到最下面一个窗格
“nmap :FirstExplorerWindow ” 切换到最上面一个窗格
nmap wm :WMToggle ” 是nomal模式的命令,不是Ex模式的
“——————————————————————————–
” MiniBufExp
“——————————————————————————–
“let g:miniBufExplMapWindowNavV im = 1
let g:miniBufExplMapWindowNavA rrows = 1
let g:miniBufExplMapCTabSwitch Bufs = 1
“let g:miniBufExplModSelTarget = 1
“——————————————————————————–
” cscope
“——————————————————————————–
cs add /home/nfs/microwindows/src/cscope.out /home/nfs/microwindows/src
:set cscopequickfix=s-,c-,d-,i-,t-,e-
:set cscopetag
” 按下面这种组合键有技巧,按了后要马上按下一个键,否则屏幕一闪
” 就回到nomal状态了
” s的按法是先按”Ctrl+Shift+-”,然后很快再按”s”
nmap s :cs find s =expand(“”) :cw
nmap g :cs find g =expand(“”) :cw
nmap c :cs find c =expand(“”) :cw
nmap t :cs find t =expand(“”) :cw
nmap e :cs find e =expand(“”) :cw
nmap f :cs find f =expand(“”)
nmap i :cs find i =expand(“”) :cw
nmap d :cs find d =expand(“”) :cw
“——————————————————————————–
” Grep
“——————————————————————————–
“直接按下键来查找光标所在的字符串
nnoremap :Rgrep
“——————————————————————————–
” A
“——————————————————————————–
nnoremap :A
“——————————————————————————–
” NERD_commenter
“——————————————————————————–
let NERD_c_alt_style = 1 ” 将C语言的注释符号改为//, 默认是
“nmap ,cc
“——————————————————————————–
” SuperTab :SuperTabHelp
“——————————————————————————–
let g:SuperTabRetainCompletion Type = 2
let g:SuperTabDefaultCompletio nType = “”
“——————————————————————————–
” CVim :help csupport
“——————————————————————————–
let g:C_Comments = “no” ” 用C++的注释风格
let g:C_BraceOnNewLine = “no” ” ‘{‘是否独自一行
let g:C_AuthorName = “xc”
let g:C_Project=”F9″
let g:Cpp_Template_Function = “c-function-description-xc”
let g:C_TypeOfH = “c” ” *.h文件的文件类型是C还是C++
“##################################################################
“########################## End Of Vimrc ##########################
“##################################################################
” if filetype is C
” TODO
” fi