首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

,vim+ctags怎么查找一个tag的所有引用,而不是定义

2013-03-06 
请教高手,vim+ctags如何查找一个tag的所有引用,而不是定义。请教高手,vim+ctags如何查找一个tag的所有引用,

请教高手,vim+ctags如何查找一个tag的所有引用,而不是定义。
请教高手,vim+ctags如何查找一个tag的所有引用,而不是定义。
比如我定义了一个函数,abc()
我要查找整个工程里面都有些谁引用了我的abc函数,怎么弄?
[解决办法]

引用:
请教高手,vim+ctags如何查找一个tag的所有引用,而不是定义。
比如我定义了一个函数,abc()
我要查找整个工程里面都有些谁引用了我的abc函数,怎么弄?

加装cscope

cscope commands:                                                                                 
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
help : Show this message              (Usage: help)
kill : Kill a connection              (Usage: kill #)
reset: Reinit all connections         (Usage: reset)
show : Show connections               (Usage: show)
[解决办法]
引用:
引用:
请教高手,vim+ctags如何查找一个tag的所有引用,而不是定义。
比如我定义了一个函数,abc()
我要查找整个工程里面都有些谁引用了我的abc函数,怎么弄?

加装cscope

cscope commands:
add  : Add a new database             (Usage: add file

[解决办法]
dir [pre……




cs f t xxxxx

[解决办法]
引用:
引用:
cscope add xxx不是在console里输入,是在vim里输入 :cs add xxx


我现在是在vim里面输入了,但是如果从cscope.out目录下面开始打开文件那么也可以用cscope
但是我进入子目录再用cscope就不行了。

还有是不是我每次打开文件都要输入cs add xxx?
有没有好的办法?


每次打开文件都要执行:cs add xxx,
你可以把那个写到配置文件里去,我是这么写的,
顺便把cs find type xxx都绑定到快捷键了.
if has("cscope")
    nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
    nmap <C-\>d :cs find d <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-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
    nmap <C-\>i :cs find i <C-R>=expand("<cfile>")<CR><CR>
    nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
    nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
    if filereadable("cscope.out")
        cs add cscope.out
        "这里可以写绝对路径
    endif
endif

热点排行