Cscope provides a rudimentary commandline interface for exploring your C or C++ codebase. But using it along with Vim provides a much richer interface.
- Make sure you have installed Cscope and know how to use it. This is explained here.
To be able to use Cscope inside Vim, install the cscope_maps.vim plugin file. This old file can be found mirrored at this Github repository here.
Open Vim in the root of the code directory that has the generated Cscope cross-reference file cscope.out.
Open any source file and move cursor to any symbol and use the following commands:
Ctrl-\ sto jump to any instance of the symbol,
Ctrl-\ fto jump the file under the cursor,
Ctrl-\ gto jump to the definition and
Ctrl-\ cto jump to calls of the function under cursor.
Use the Vim command
Ctrl-oto jump back to previous locations in files.
If you are using a cross-reference file with a filename that is not cscope.out or it is not in the current directory, then export that file path in the
CSCOPE_DBenvironment variable. Vim will use that path to read the cross-reference file.
Tried with: Cscope 15.8b, Vim 7.4 and Ubuntu 16.04