Using ctags with MacVim for Objective C on OS X
- Install Homebrew if you haven’t.
- Run
brew install ctags
. The version of ctags that ship of OS X is an antique. - Run
echo "--langdef=objc" >> ~/.ctags && echo "--langmap=objc:.m" >> ~/.ctags && echo "--regex-objc=/^[\t ]*(\-|\+)[\t ]*\([_a-zA-Z0-9][_a-zA-Z0-9]*\)([_a-zA-Z0-9][_a-zA-Z0-9]*)/\2/f/" >> ~/.ctags
- cd to the directory to write the tags file in
- Run
ctags -R mytargetdirectory
- Press ^] in MacVim over a function name to go to declaration/definitions
PS: Creating the .ctags file is so convoluted because I can’t figure out how to put a multiliner without ruining the formatting in the instructions.