Cscope is ancient! It began at Bell Labs prior to 2000 and is now open source. It is a curses based text UI.
At first, I turned away from Cscope because it had its own interface. I liked ctags because there was good Vim support and essentially ctags becomes just a nice Vim extension once you add a few key mappings. I now learn that Vim generally has the cscope plugin enabled and built in.Also note that there is a man page for cscope, so type "man cscope" and gawk at all the options.
I want to follow the "Cscope with vim" tutorial, so I do as they say, download cscope_maps.vim, then do:
cd .vim mkdir plugin cp xxx/cscope_maps.vim pluginAlso add this to your .bashrc (and type it into your current terminal window).
export CSCOPE_EDITOR=vimI will try using it in my "Hydra" project.
cd Hydra cscope -RbThe "b" flag says to just build the database and exit without starting the Cscope UI. You could type just "cscope -R" and it would build the database and launch the UI. Then later you just type "cscope" to lauch the UI.
Better yet, you may want to use "cscope -Rqb". The "q" flag tells cscope to also build an inverted index, which can speed things up on large source trees. Best yet is to use "cscope -Rqcb". Here the "c" flag says to not compress data.
Now to start cscope, just type cscope -- or maybe "cscope -d" where the -d says to not regenerate the database. Or better yet, setup vim as below and just start vim like you always do.
Now I have a database and Cscope works. I use the arrow keys to go up and down and try various searches. I use the tab key to go between the search results list and the search menu. When I hit return on an item in the search list, it opens that in an editor (nano by default). I want to change this to Vim, so I exit and do what I describe above to set the CSCOPE_EDITOR variable.
Things work pretty well now, but I get an error about a duplicate cscope database from the plugin. I comment out the offending line in cscope_maps.vim and now things are good.
If the search is unambiguous, vim just goes there without a silly one item menu. And you can even search on code that has been commented out.
Supposedly Ctrl-space followed by "s" should do a window split, putting the search results in a new window. This does not work for me. If it ever does work, use Ctrl-W x to manage these split windows, where "x" is one of: "w" to move between windows, hnkl to move as per usual vim motion, and "c" or "q" to close/quit the whole split window business.
Vim has quite a bit of stuff built in to support Cscope. Use ":help cscope" which takes you to if_cscop.txt and/or type ":cscope help".
Tom's Computer Info / tom@mmto.org