top of page

Quickly Enable cscope in Vim


This post list a set of steps to quickly start browsing code in vim. Its a short version of http://cscope.sourceforge.net/cscope_vim_tutorial.html.

1. Install cscope with:

2. Make ~/.vim/plugin

3. Copy this into a file called ~/.vim/plugin/cscope_maps.vim:

4. Run this in your source tree:

The cscope status bar will grow:

Until it completes:

5. Type Control+d to quit.

6. Open a source file. Move the cursor over a symbol and type: Control+\ s.

Note

A potentially more useful method is to present the result in a split window. With the cursor over the symbol of interest, type Control+spacebar s. Type Control+w arrowkey to enter the window. With the window selected, type Control+w q to close the window.

Note 2

In addition to s you can use these:

...from ~/.vim/plugin/cscope_maps.vim

7. Type the # of the result.

Example

Type 2 to jump to cdns_wdt_probe

8. Type Control+t to get back to where you were, i.e. "popping off the tag stack"

Reference

GNU image from link

Comments


bottom of page