Specifically, Cscope is used to find symbols in source code, for example variables, functions, files etc.. In order to use Cscope with leaving Vim, most of Vim have the Cscope plugin enabled. This article is going to introduce how to use Cscope integrated Vim to browse source code. Step 1: Building Cscope database of your source code Cscope database likes indexes of your source code, which facilitate finding your source code symbols more fast. Firstly, open a shell and enter you source code directory.

Author:Gagal Grom
Language:English (Spanish)
Published (Last):13 September 2018
PDF File Size:13.64 Mb
ePub File Size:8.79 Mb
Price:Free* [*Free Regsitration Required]

Give help information about cscope commands. Special keys If your terminal has arrow keys that work in vi, you can use them to move around the input fields. Line-Oriented interface The -l option lets you use cscope where a screen-oriented interface would not be useful, for example, from another screen-oriented program.

For -l, cscope outputs the number of reference lines cscope: 2 lines For each reference found, cscope outputs a line consisting of the file name, function name, line number, and line text, separated by spaces, for example, main.

You can use the r command to rebuild the database. This format is used by both emacs and vi. Users of most standard editors vi, emacs do not need to set this variable. HOME Home directory, which is automatically set at login. TERM Terminal type, which must be a screen terminal. If your terminal is not in the standard terminfo directory, see curses and terminfo for how to make your own terminal description.

VPATH A colon-separated list of directories, each of which has the same directory structure below it. If VPATH is set, cscope searches for source files in the directories specified; if it is not set, cscope searches only in the current directory. Files cscope. For example, if you indicated -f xyz, then these files would be named xyz. The return type may precede the function name; cscope will still recognize the declaration. Function definitions that deviate from this form will not be recognized by cscope.

Similarly, the use of a variable may be incorrectly recognized as a definition.


Ctags Tutorial

Vim to use it. Fortunately, Cscope support has been built into Vim. But since Cscope has more search types than ctags, there are a few differences. Ideally, you will also have Vim 6. Most Vim binaries that ship with Linux distributions have the Cscope plugin enabled. If you are using Vim 6. If you are using Vim 5.


Subscribe to RSS

Jump to the tag underneath the cursor M-. Say yes when prompted to load the really big tags file. The first command is probably the one you will use most often: it jumps to the definition of the tag function name, structure name, variable name, or pretty much anything. The second command can be used to search for any tag in the TAGS file, regardless of the file you are currently viewing. Sometimes Etags will find multiple definitions for a given tag; when this is the case, use the third command to jump through the possible definitions until you find the one that you want. Finally, use the fourth command to jump back up in the tag "stack. Switch to the new buffer C-x o , scroll through the list of definitions to the one that you want, then press Enter to open the file.

Related Articles