I am using cscope and ctags in vim editor for a c++ project. I have generated ctags and cscope files as below from the root of the project.
ctags -R --c++-kinds=+p --fields=+iaS --extra=+q
find . -name "*.c" -o -name "*.cpp" -o -name "*.h" -o -name "*.hpp" > cscope.files
cscope -q -R -b -i cscope.files
my ~/.vimrc file contents are as below.
set tags+=./tags;/
filetype plugin on
cs add $CSCOPE_DB
I have added below line in .bashrc
export CSCOPE_DB=/home/kadina/build/platform/component/platform/stb/cscope.out
And I have downloaded cscope_maps.vim from internet and place it in ~/.vim/plugin/
But when I tried to find the definition of a function by ctrl + }, it is listing down all the function definitions with the same name instead of navigating to the correct function.
For example, when I tried to find the definition of VZ_DIAGNOSTICS::getInstance(), it is not navigating to the definition of VZ_DIAGNOSTICS::getInstance(), instead it is listing all the function definitions with the name as getInstance().
I am facing same problem, when I tried to find who is calling this function by ctrl + \ + c. It is listing down the functions which are calling getInstance() instead of listing down the functions which are calling VZ_DIAGNOSTICS::getInstance().
Can anyone please let me know what changes I need to make to work these things correctly?
Because it uses cstags instead of ctags.
Here is the config I use. I don't install cscope_maps.vim because I don't need keyboard shortcuts for cscope.
set nocscopetag
disables cstags. Other stuff make it load cscope.out in a git project automatically without environment variable.
set nocscopetag
if filereadable("cscope.out")
cscope add cscope.out
else
let git_path = finddir('.git', '.;')
let cscope_path = git_path . "/../cscope.out"
let proj_dir = git_path . "/../"
if filereadable(cscope_path)
execute "cscope add " . cscope_path . ' ' . proj_dir
endif
endif