Clicky

Using ctags with MacVim for Objective C on OS X

Hi, I'm Hwee-Boon Yar

I write, ship and sell software products. iOS/OS X app developer based in Singapore, working remotely. This is my blog.

.

Need to run a code review on your codebase? Hire me

  1. Install Homebrew if you haven't.
  2. Run brew install ctags. The version of ctags that ship of OS X is an antique.
  3. 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
  4. cd to the directory to write the tags file in
  5. Run ctags -R mytargetdirectory
  6. 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.

Like this post? Follow me @hboon on Twitter.