如何让 cscope 在 cscope.out 文件中使用绝对路径? [英] How to let cscope use absolute path in cscope.out file?

查看:21
本文介绍了如何让 cscope 在 cscope.out 文件中使用绝对路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次在 Vim 中加载 cscope.out 后,我​​都需要将 Vim 的pwd"更改为与 cscope.out 文件所在的目录相同的目录,这可能是由于 cscope 在生成标记文件时使用了相对路径.因此,如果有一种方法可以强制 cscope 在其标记文件中使用绝对路径 - cscope.out,那么无论您的 Vim 会话的密码是否与 cscope.out 文件所在的目录相同.

Everytime after load a cscope.out in Vim, I need to change Vim's "pwd" to the same directory as cscope.out file is under, which might be due to that cscope use relative path when generating tag file. So if there is a way to force cscope to use absolute path in its tag file - cscope.out, then it will be regardless of whether the pwd of your Vim session is the same as the directory that cscope.out file is under.

推荐答案

您可以通过设置<代码>cscoperelative 选项.来自 :help csre:

You can ask vim to interpret the paths in cscope.out relative to the location of the cscope.out file by setting the cscoperelative option. From :help csre:

如果设置了 'cscoperelative',则在没有给定前缀的情况下cscope(前缀是 cscope 的 -P 选项的参数),基本名称将使用 cscope.out 位置(通常是项目根目录)作为构建绝对​​路径的前缀.默认为关闭.注意:此选项仅在 cscope (cscopeprg) 为初始化时没有前缀路径 (-P).

If 'cscoperelative' is set, then in absence of a prefix given to cscope (prefix is the argument of -P option of cscope), basename of cscope.out location (usually the project root directory) will be used as the prefix to construct an absolute path. The default is off. Note: This option is only effective when cscope (cscopeprg) is initialized without a prefix path (-P).

示例

:设置 csre
: 设置 nocsre

: set csre
: set nocsre

这篇关于如何让 cscope 在 cscope.out 文件中使用绝对路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆