10 June 2007

ctags with PHP in vim

Another tip to code PHP effectively

cd /path/to/framework/library
exec ctags-exuberant -f ~/.vim/mytags/framework \
-h ".php" -R \
--exclude="\.svn" \
--totals=yes \
--tag-relative=yes \
--PHP-kinds=+cf \
--regex-PHP='/abstract class ([^ ]*)/\1/c/' \
--regex-PHP='/interface ([^ ]*)/\1/c/' \
--regex-PHP='/(public |static |abstract |protected |private )+function ([^ (]*)/\2/f/'

to load it,
:set tags=~/.vim/mytags/framework

Ctrl-], and you'll jump to the file and line of its declaration; Ctrl-T then takes you back
Ctrl-W ], it will split the current window and open the declaration in the new pane