add the following text to .vimrc or .gvimrc:
if has("cscope")
set csprg=/usr/bin/cscope
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 <[email protected]>s :cs find s
<C-R>=expand("<cword>")<CR><CR>
nmap <[email protected]>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <[email protected]>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <[email protected]>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <[email protected]>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <[email protected]>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <[email protected]>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <[email protected]>d :cs find d <C-R>=expand("<cword>")<CR><CR>
当光标停在某个你要查找的词上时, 按下<C-_>g, 就是查找该对象的定义, 其
他的同理.
按这种组合键有一点技巧,按了<C-_>后要马上按下一个键,否则屏幕一闪就回到
nomal状态了
<C-_>g的按法是先按"Ctrl+Shift+-", 然后很快再按"s"
ubuntu cscope,码迷,mamicode.com
时间: 2024-10-15 22:49:26