cscope相关
文章目录
安装yum install cscope -y
indexcscope -Rbkq
vi配置
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" cscope setting
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has("cscope")
set csprg=/usr/bin/cscope
set csto=1
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
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>
用法
vi中添加cscope数据库
. vi命令模式添加
:cs add cscope.out
. .vimrc中自动添加
见上面vimrc配置vi中重新加载cscope数据库
// 如果需要重建index
:!cscope -Rbq
:cs show
:cs reset cscope.out符号查找:
. vi命令模式:
:cs find s xxx
. 快捷键:
配置见上面vimrc配置
光标置于符号 ctrl+\ s其它快捷键:
ctrl+]:跳转到函数定义
ctrl+t:返回上一个查找的地方其它
. c++支持
#!/bin/sh
find . -name ”*.h” -o -name ”*.c” -o -name ”*.cc” > cscope.files
cscope -bkq -i cscope.files
ctags -R
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论