Generate PHP tags with exctags on FreeBSD

Generally, exctags(1) on FreeBSD is what you know as ctags on Linux based systems.

1.  Install exctags from port

# cd /usr/ports/devel/ctags
# make install clean
 
 
Note: If you install ctags by command pkg install ctags, the ctags included in the basesystem is not what you expect on Linux based systems.
For ctags you are looking for install ctags from package/ports, it will provide you with exctags binary.

2.  Generate tags 

I generate tags by putting the generate_tags.sh script to the project directory and executes it.

#!/bin/sh
exec exctags \
--languages=PHP \
--langmap=PHP:+.phpt \
-h ".php" -R \
--exclude="\.git" \
--totals=yes \
--tag-relative=yes \
--PHP-kinds=+cdf \
--regex-PHP='/abstract class ([^ ]*)/\1/c/' \
--regex-PHP='/interface ([^ ]*)/\1/c/' \
--regex-PHP='/(public |static |abstract |protected |private )+function ([^ (]*)/\2/f/'
 
CTRL + ]  Go to tag's definition. 
 
CTRL + t  Jump back from definition.
or
CTRL + o  Jump back from definition.
 
You can learn more vim and ctags tips and tricks from: 
 
And more information with the article Use vim with (ex)ctags
 
References:

https://stackoverflow.com/questions/563616/vim-and-ctags-tips-and-tricks

posted @ 2021-11-20 17:57  enjoy_jun  阅读(82)  评论(0编辑  收藏  举报