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.
相关问题
- Emacs shell: save commit message
- How to change the first two uppercase characters o
- Insert text into current buffer from function
- Hot reload on save
- Substituting zero-width match in vim script
相关文章
- 如何让 vim 支持 .cshtml 文件的代码高亮
- Auto-save in VIM as you type
- How can I use gcc's -I command to add recursiv
- Vim: overloaded mapping for multiple modes
- How to use relative line numbering universally in
- How to copy the value of a vim option to a registe
- E185: Cannot find color scheme*
- How do I fix vim to properly indent folds containi
The cscope tutorial has a very simple workaround for this problem:
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
:When importing cscope.out, you can supply the prefix, i.e.
Then your searches will turn up like:
Note: since I am not senior enough to add comments yet: Aaron and Neha's answers were useful to me to learn more about the entire system, but the best and most direct answer to the question is currently in 3rd place and is Shayan's.
The asker was more asking about getting absolute pathnames by cscope, not working around it using (the very capable and powerful) vim.
Note2: There is another way to make a single change in vim and accomplish the same as what Neha did.
I like Neha's better, but this way is closer to modifying cscope rather than vim settings, if this is what you want. And this is the only way that allows you to move the cscope db to anywhere.
You can create your cscpoe.files using absolute paths to your files, here is my scripts to generate my cscope databases
Then just vim cscope.files and maybe :cs add cscope.out, although my cscope plugin does that automatically. Then I search for the files I am interested in and jump to them with gf.
@Aaron H. is right.
For my configuration I used the cscope_maps.vim plugin and modified the following lines:
Where "/usr/project" is the location of the cscope.out file and the absolute path I want to use.