Vim goto definition

For navigation in large code bases. Mostly these have been tried with C/C++, but works similarly for other languages - Go, PHP, Elixir with some customization.
OS used - Ubuntu

Goto definition
Install ctags -> sudo apt-get install exuberant-ctags 
Activate ctags from project root -> ctags -R 
Open all source files from this project root in Vim
To goto function/variable definition under cursor -> Ctrl + ]  
To jump back ->  Ctrl + t  

Goto local variable/global variable declaration
If tag not found for some global variable/local variable/static/function
For definition and search(keyword under cursor) in same file(highlighter works with some good vim plugins) -> gd 
For global definitions -> gD 
To jump back -> Ctrl + o 

Goto header files
To go-to file ->   gf  
To jump back -> Ctrl + o 

This article will get updated more. The main aim is to keep it minimal.

Comments

Popular posts from this blog

error: stray '\' in program

error: invalid application of ‘sizeof’ to incomplete type ‘struct ’

ssh: Could not resolve hostname git: No address associated with hostname