现在的位置: 首页 > 综合 > 正文

我也来晒一下我的vim配置文件

2014年02月10日 ⁄ 综合 ⁄ 共 1365字 ⁄ 字号 评论关闭

包括一些最简单常用的配置,插件包括ctags, taglist, winmanage, cscope。用上这几个插件可以把vim打造成一个IDE环境,通过添加syntax可以定制你的语法高亮,但由于vim本身不能解析语言本身,高亮无法做到跟sourceinsiht一个丰富。使用code_comeplete插件加上vim本身众多的快捷键可以大大加速写代码的速度。

syntax enable
set tabstop=4
set backspace=2
set linebreak

set incsearch
set gdefault
set laststatus=2
set ruler

"programe related setting
filetype plugin indent on
set completeopt=longest,menu
syn on
set showmatch
set smartindent
set shiftwidth=4
set autoindent
set ai!

"ctags related setting
set tags=tags,tagsx

"Taglist related setting
let Tlist_Exit_OnlyWindow=1
nmap <F2> :TlistToggle<cr>

"winmanage related setting
let g:winManagerWindowLayout=&apos;FileExplorer|TagList&apos;
let g:winManagerWidth=35
let g:defaultExplorer=0
nmap <F1> :WMToggle<cr>

"cscope related setting
if has("cscope")
 set csprg=/usr/bin/cscope
 set cscopequickfix=s-,c-,d-,i-,t-,e-
 set csto=0
 set cst
 set nocsverb
 " add any database in current directory
 if filereadable("cscope.out")
     cs add cscope.out
 " else add database pointed to by environment
 elseif $CSCOPE_DB != ""
     cs add $CSCOPE_DB
 endif
 set csverb
endif

nmap <F3>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <F3>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <F3>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <F3>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <F3>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <F3>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <F3>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <F3>d :cs find d <C-R>=expand("<cword>")<CR><CR>

抱歉!评论已关闭.