麻烦, 于是自己憋着想写一个, 写了一半, 试了下去官网搜索, 竟然有!!
autoload_cscope.vim
http://www.vim.org/scripts/script.php?script_id=157
就像ctags设定set tags=tags; 在项目根目录生成总的tags, 任意子目录下即可自动加载...
用了这个插件, 项目根目录生成cscope.out, 随便钻到哪个项目子目录下, 自动正常加载, 正常搜索...
Tips:
代码: 全选
alias更方便
alias cr='ctags -R --fields=+lS && cscope -Rbq'
这个全局变量设置下, 禁止这个插件自带的mapping
let g:autocscope_menus=0
代码: 全选
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Cscope
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Use both cscope and ctag
set cscopetag
" Show msg when cscope db added
set cscopeverbose
" Use tags for definition search first
set cscopetagorder=1
" Use quickfix window to show cscope results
set cscopequickfix=s-,c-,d-,i-,t-,e-
" Cscope mappings
nnoremap <C-w>\ :scs find c <C-R>=expand("<cword>")<CR><CR>
nnoremap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nnoremap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nnoremap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nnoremap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nnoremap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nnoremap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nnoremap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nnoremap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>
我启用了cscope的quickfix, 但是它的反应和tags不一样, 不是开个quickfix窗口让你选, 而是直接跳到第一个, 虽然你可以自己打开quickfix窗口...绑定和手动都是这样...