您的位置:首页 > 其它

Vimrc基础 VIM配置之常用插件配置

2014-04-16 16:30 417 查看
我目前在使用的几个插件,cscope,ctags,windowmanager,nerdtree,minibuf,都可以在vimscript上下载到,下面是我的插件配置项,由于插件比较少,加上服务器都不能连网,所以没有使用vundle进行插件管理。有了这些进行日常代码编辑和浏览应该能比较顺溜了。

"VimScript plugins settings {{{

"VimScript plugins cscope settings {{{

" This tests to see if vim was configured with the '--enable-cscope' option

" when it was compiled.  If it wasn't, time to recompile vim...

if has("cscope")

    " Standard cscope/vim boilerplate

    " use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t'

    set cscopetag

    " check cscope for definition of a symbol before checking ctags,

    " set to 1 if you want the reverse search order.

    set csto=0

    " add any cscope database in current directory

    if filereadable("cscope.out")

        cs add cscope.out 

        " else add the database pointed to by environment variable

    elseif $CSCOPE_DB != ""

        cs
4000
add $CSCOPE_DB

    else

       "echo "no cscope files found ,please add manually!"

    endif

    "cs add /home/src/cscope.out /home/src

    set cscopequickfix=s-,c-,d-,i-,t-,e-

    "同时搜素cscope数据库和tags

    set cscopetag

    " 按下面这种组合键有技巧,按了<C-_>后要马上按下一个键,否则屏幕一闪

    " 就回到nomal状态了

    " <C-_>s的按法是先按"Ctrl+Shift+-",然后很快再按"s"

    "cw打开quickfix窗口

    "0 或 s 查找本 C 符号(可以跳过注释)

    nnoremap <C-\>s :cs find s <C-R>=expand("<cword>")<cr><cr> :cw<cr>

    "1 或 g 查找本定义

    nnoremap <C-\>g :cs find g <C-R>=expand("<cword>")<cr><cr> :cw<cr>

    "2 或 d 查找本函数调用的函数

    nnoremap <C-\>d :cs find d <C-R>=expand("<cword>")<cr><cr> :cw<cr>

    "3 或 c 查找调用本函数的函数

    nnoremap <C-\>c :cs find c <C-R>=expand("<cword>")<cr><cr> :cw<cr>

    "4 或 t 查找本字符串

    nnoremap <C-\>t :cs find t <C-R>=expand("<cword>")<cr><cr> :cw<cr>

    "6 或 e 查找本 egrep 模式

    nnoremap <C-\>e :cs find e <C-R>=expand("<cword>")<cr><cr> :cw<cr>

    "7 或 f 查找本文件

    nnoremap <C-\>f :cs find f <C-R>=expand("<cfile>")<cr><cr>

    "8 或 i 查找包含本文件的文件

    nnoremap <C-\>i :cs find i <C-R>=expand("<cfile>")<cr><cr> :cw<cr>

endif

"}}}

"VimScript plugins nerdtree settings {{{

let NERDChristmasTree=1

let NERDTreeAutoCenter=1

let NERDTreeBookmarksFile=$HOME/'.vim/nerdTreeBookMarks.txt'

let NERDTreeMouseMode=2

let NERDTreeShowBookmarks=1

let NERDTreeShowFiles=1

let NERDTreeShowHidden=1

let NERDTreeShowLineNumbers=1

let NERDTreeWinPos='left'

let NERDTreeWinSize=31

nnoremap f :NERDTreeToggle<cr>

"}}}

"VimScript plugins taglist settings {{{

let Tlist_Show_One_File=1

let Tlist_Exit_OnlyWindow = 1

"it's on the left by default

"let Tlist_Use_Right_Window=1

" add any cscope database in current directory

if filereadable("tags")

    set tags=tags

else

   " echo "no tags file found! please load manually!"

endif

nnoremap t :TlistToggle<cr>

"}}}

"VimScript plugins windowmanager settings {{{

let g:winManagerWindowLayout='FileExplorer|TagList'

"let g:winManagerWidth = 30

"let g:defaultExplorer = 0

" 切换到最下面一个窗格

nnoremap <C-w><C-b> :BottomExplorerWindow<cr>

" 切换到最上面一个窗格

nnoremap <C-w><C-f> :FirstExplorerWindow<cr>  

nnoremap wm :WMToggle<cr>

noremap <c-w><c-t> :WMToggle<cr>

"}}}

"VimScript plugins minibuf settings {{{

"用ctrl加hjkl键切换标签

let g:miniBufExplMapWindowNavVim = 1

"用ctrl加箭头键切换标签

let g:miniBufExplMapWindowNavArrows = 1

"用tab键切换标签

let g:miniBufExplMapCTabSwitchBufs = 1

let g:miniBufExplModSelTarget = 1

"}}}

"VimScript plugins grep settings {{{

nnoremap <silent> <F3> :Grep<CR>

"}}}

"VimScript plugins netrw settings {{{

"let g:netrw_winsize = 30       " 浏览器宽度

"}}}

"VimScript plugins quickfix settings {{{

"应该限定为只在quickfix窗口生效,待改进

nnoremap <F6> :cn<cr>   " 切换到下一个结果

nnoremap <F7> :cp<cr>   " 切换到上一个结果

"}}}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  IDE VIM