The ctags program generate an index (or a "tag") file for a variety of language objects found in file(s). This tag file allows these items to be quickly and easily located by a text editor or other utility. A "tag" signifies a language object for which an index entry is available.
To generate the tags recursively for a source directory
ctags -R <dir>
New tags can be appended to the current tag file "tags" file
ctags -R -a <dir>
To search for a specific tag and open Vim to its definition
vim -t <tag>
Once Vim is opened we can navigate the project using the following basic commands:
<C-]>- jump to the tag underneath the cursor (function, structure, variable)
<C-t>- jump back up in the tag stack
:ts <tag>- search for a tag
:tn- go to the next definition for the last tag
:tp- go to the previous definition for the last tag
:ts- list all of the definitions of the last tag
Provides smart autocompletion for programs. When invoked, the text before the cursor is inspected to guess what might follow. A popup menu offers word completion choices that may include struct and class members, system functions, and more.
Omni completion is not usually enabled by default. To turn on omni completion, add the following go vimrc
filetype plugin on set omnifunc=syntaxcomplete#Complete
To use omni completion, type
<C-x><C-o> while in Insert mode.
By default header files prototypes are not included in the tags file. Use the following options if you wish to index the prototypes as well.
ctags -R --c++-kinds=+p --fields=+S
Proudly self-hosted on a cheap Raspberry Pi