I am trying to use cscope with vim and I find things a little confusing.
Let’s say I have a project in /home/user/projects/project_foo/. If I go through cscope directly it all works fine (I can find symbols). If I go through vim I get no cscope connections error. So I don’t understand how it works.
As far as I understand you have to build a database for your project, but when I run cscope [-R] [-b] in project’s directory no file is created in this directory. So where is the database created? Is there a separate database for each project or a global database?
Do I have to rebuild the database each time I make a change to the project symbols (e.g. add a function)?
How do I make vim (loaded from the project’s directory) to use the database for that project. If there is a global database can I make vim search only within the current project?
I found some scattered information about this things but it is all very confusing for a first time user. If you could clarify these things it would make it more clear and I would be able to figure out the rest.
Thanks to tristan:
:h cscope-howtouse
:h cscope-suggestions
cscope -b creates the database cscope.out.
:cs add cscope.out adds the database.
Do I have to rebuild the database each time I make a change to the project symbols (e.g. add a function)?
If you want to be able to find that particular function, yes. You can still do without rebuilding the database, but if you will add lines of code (for example), cscope will point you to the original location of a symbol it had in the file when the database was created.
How do I make vim (loaded from the project’s directory) to use the database for that project. If there is a global database can I make vim search only within the current project?
You can do do that by changing the vimrc script. The Autoloading cscope database tutorial is a good example for things that you can configure.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With