Linux

cscope

aucd29 2013. 9. 26. 20:52
cscope

//
// Command
//

[option]
s : C symbol
g : definition
d : called by function
c : calling this function
t : assignments to
e : egrep pattern
f : this file
i : #including file

[Accelerator]
css, csc, csd, csg, cst

//
// cscope setting
// Target file : $HOME/.vimrc
//

"============ cscope config ============
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
    "set path=./,../
" else add database pointed to by environment
else
    cs add /usr/src/linux/cscope.out
    "set path=/usr/src/linux
endif
set csverb



func! Css()
let css = expand("<cword>")
new
exe "cs find s ".css
if getline(1) == ""
exe "q!"
endif
endfunc

nmap ,css :call Css()<cr>



func! Csc()
let csc = expand("<cword>")
new
exe "cs find c ".csc
if getline(1) == ""
exe "q!"
endif
endfunc

nmap ,csc :call Csc()<cr>



func! Csd()
let csd = expand("<cword>")
new
exe "cs find d ".csd
if getline(1) == ""
exe "q!"
endif
endfunc

nmap ,csd :call Csd()<cr>



func! Csg()
let csg = expand("<cword>")
new
exe "cs find g ".csg
if getline(1) == ""
exe "q!"
endif
endfunc

nmap ,csg :call Csg()<cr>


func! Cst()
let cst = expand("<cword>")
new
exe "cs find t ".cst
if getline(1) == ""
exe "q!"
endif
endfunc

nmap ,cst :call Cst()<cr>