OSX + Vim + CTags (Exuberant) for fast context switching in large projects
Installing CTags (Exuberant)
Lets first install ctags-exuberant using Homebrew
1 brew install ctags-exuberant
Remember the path that ctags got installed to, with version 5.8 on my machine it was in:
Setting up Vim/MacVim
Download the TagList plugin from VimOnline.
In your .vimrc file add the following:
1 let Tlist_Ctags_Cmd='/usr/local/Cellar/ctags/5.8/bin/ctags' 2 3 let g:Tlist_Ctags_Cmd='/usr/local/Cellar/ctags/5.8/bin/ctags' 4 5 fu! CTagGen() 6 :execute "!" . g:Tlist_Ctags_Cmd . " -R ." 7 endfunction 8 9 nmap <silent> :ctg :call CTagGen()
Open up vim/MacVim, and type
You can then go to a controller for example:
And the follow should appear.
Lets say I’ve got my cursor on StoryType and I want to go to the model, I can just hit Ctrl+] to get there. You can now do this for any method (helpers, methods, anything thats in your ctags file!).