Getting ctags Working in BBEdit 8.7
I was messing with Vim's ctags support today on my Mac and then somehow wondered if either SubEthaEdit or BBEdit had support for ctags like Vim had. I dug into it and in fact BBEdit can support ctags, but unfortunately not the ctags that exist with Mac OS X 10.4 - you need the exuberant ctags on sourceforge.net. They talk extensively about it in Chapter 14 of the BBEdit manual. You need to download, build and install the ctags app:
cd ctags-5.7 ./configure --prefix=/usr/local make sudo make install
In order to have it not conflict with the existing ctags I did the following:
cd /usr/local/bin sudo mv ctags ectags
I also changed the name of the man page to get that matching the new command:
cd /usr/local/man/man.1 sudo ctags.1 ectags.1
and to make sure this man page gets into the existing MANPATH - if you don't want to add this location to your MANPATH, you can do:
cd /usr/local/share/man/man1 sudo ln -s /usr/local/man/man1/ectags.1 .
Then I created a simple alias that allows me to call it simply with the right arguments for the file BBEdit needs:
alias ectags `ectags --excmd=number --tag-relative=no --fields=+a+m+n+S -R'
So that in the Makefiles for BKit and CKit I can add the target:
CTAGS = ectags --excmd=number --tag-relative=no --fields=+a+m+n+S -R ... tags: @ $(CTAGS) `pwd`/src
And this way I can then automatically pick up the tags in both projects. It's nice that CVS doesn't try to update the file called 'tags', and placing it at the top of the source tree allows BBEdit to find it - as well as Vim, if I'm into that as well.
In the end, this is a really nice little addition. I'm a little surprised that the BBEdit folks didn't include it as a part of the BBEdit distribution so that you would not have to download it and build it. I mean really they know that Mac OS X 10.4 doesn't come with it, and they are going to need it, so I can't quite figure out why they didn't include it. But they didn't. Easy enough to download and build.
UPDATE: I also found that there are 'Jump' and 'Jump Back' menu commands that I've got hot keys set up for. This makes it very easy to jump to a functional definition based on the ctags and then back to where I was, and then back to the definition. Very nice. Gotta love BBEdit for this.