首页 > 代码库 > cscope usage
cscope usage
1) Reference:
Linux 平台下阅读源码的工具链
程序员的利器 – cscope
2) cscope help:
:help cscope
:help cscope-suggestions
:cs help
3) Generate index files:
find fullpath/of/your/project –type f > cscope.files
cscope -bq
4) cscope command:
add : Add a new database (Usage: add file|dir [pre-path] [flags])
find : Query for a pattern (Usage: find c|d|e|f|g|i|s|t name)
c: Find functions calling this function
d: Find functions called by this function
e: Find this egrep pattern
f: Find this file
g: Find this definition
i: Find files #including this file
s: Find this C symbol
t: Find assignments to
5) Add cscope setting in .vimrc:
if has("cscope") set csprg=/usr/local/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 <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR> nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR> nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR> nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR> nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR> nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR> nmap <C-_>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR> nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR> " Using ‘CTRL-spacebar‘ then a search type makes the vim window " split horizontally, with search result displayed in " the new window. nmap <C-Space>s :scs find s <C-R>=expand("<cword>")<CR><CR> nmap <C-Space>g :scs find g <C-R>=expand("<cword>")<CR><CR> nmap <C-Space>c :scs find c <C-R>=expand("<cword>")<CR><CR> nmap <C-Space>t :scs find t <C-R>=expand("<cword>")<CR><CR> nmap <C-Space>e :scs find e <C-R>=expand("<cword>")<CR><CR> nmap <C-Space>f :scs find f <C-R>=expand("<cfile>")<CR><CR> nmap <C-Space>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR> nmap <C-Space>d :scs find d <C-R>=expand("<cword>")<CR><CR> " Hitting CTRL-space *twice* before the search type does a vertical " split instead of a horizontal one nmap <C-Space><C-Space>s \:vert scs find s <C-R>=expand("<cword>")<CR><CR> nmap <C-Space><C-Space>g \:vert scs find g <C-R>=expand("<cword>")<CR><CR> nmap <C-Space><C-Space>c \:vert scs find c <C-R>=expand("<cword>")<CR><CR> nmap <C-Space><C-Space>t \:vert scs find t <C-R>=expand("<cword>")<CR><CR> nmap <C-Space><C-Space>e \:vert scs find e <C-R>=expand("<cword>")<CR><CR> nmap <C-Space><C-Space>i \:vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR> nmap <C-Space><C-Space>d \:vert scs find d <C-R>=expand("<cword>")<CR><CR>
cscope usage
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。