To close the quickfix window, you use :cclose, as @statox mentioned in the comments.
This won't affect which code buffer you're viewing, though. Vim doesn't distinguish between the buffer you were looking at originally and the buffers you navigated to via the quickfix, so to go back you are going to have to use Vim's regular buffer switching commands. If you ...
The :execute command will assemble an Ex command from strings and evaluate it.
Here, in this case, it's actually breaking your command, since it's expanding the g:projectRoot string and forming a string that is an invalid Ex command, since the quotes around the path are now missing. That command is actually equivalent to:
Ensure setting the cscope using the following in your ~/.vimrc file:
cs add cscope.out
Once it is done, re-login into the terminal to run cscope.
Jump to a tag: Ctrl]
Jump back: CtrlO
Jump to a tag again: CtrlI
I use a shell function to perform git checkout. (I call it gco.)
This function performs some index updating, if the checkout succeeds. (In my case I am interested in updating my cindex, while you want to update your cscope.)
git checkout "$@"
if [ "$ret_status" = 0 ] && [ -n "$POST_GIT_CHECKOUT" ]
GNU Global's distribution already has a couple of vim scripts that are pretty handy.
Look for 'gtags.vim' and 'gtags-cscope.vim' (the most adequate probably for what you want) in Global's installation directory, and just copy the one you prefer to your 'plugins' dir inside vim's config. The second script will do a
for you, which ...
With cscopetag enabled, you get E257 on tags not being found (credits Mass in the comments).
Fortunately, the help for this error contains useful information: use :cstag! It can do searches in both; precedence is controlled by 'cscopetagorder'.
Of course, the error and description of cscopetag make it sound like the tag wasn't found after searching both, so ...
In the source code directory use the following command:
find . -name '*.cpp' -o -name '*.h' > gtags.files
gtags --accept-dotfiles -c -f gtags.files
This will build the cross reference.
In vim, you can issue the following command to invoke gtags-cscope