I set up cscope as explained in this tutorial. I do not want to regenerate my database on every invocation of cscope and hence I start it cscope -d
. But the problem is, I need to run this command from the directory where my DB, cscope.out resides. I keep shuffling across directories and I want the flexibility to start cscope from anywhere. I tried putting CSCOPE_DB=~/cscope/cscope.out; export CSCOPE_DB
in my .bash_profile/.bashrc to no avail. I also have export CSCOPE_EDITOR=vim
in my bash profile files and as such can invoke cscope from within vim from any directory but not the standalone cscope! It always throws the error
cscope: cannot open file cscope.out
How can I do this?
I found a workaround. Assuming my cscope DB is in ~/cscope
, I cd
into this directory, launch cscope
and go back to the directory I came from. Like so-
cd ~/cscope && cscope -d && cd - > /dev/null
Effectively, I'm able to launch cscope
from any directory( and also stay in the same directory after cscope
exits ). I've aliased the above command and just typing cs
does the trick