ctags 对PHP的支持不是很好,vim下用ctags浏览php文件会出现找不到tag的情况。解决方法:
1.编辑~/.bashrc 或 ~/.zshrc文件 ,针对php为ctags设立一个别名
alias phptags='ctags --langmap=php:.engine.inc.module.theme.php --php-kinds=cdf --languages=php'
2.编辑~/.ctags 文件,如果不存在该文件则新建文件。
写入如下内容
--regex-php=/^[ \t]*[(private|public|static)( \t)]*function[ \t]+([A-Za-z0-9_]+)[ \t]*\(/\1/f, function, functions/
--regex-php=/^[ \t]*[(private|public|static)]+[ \t]+\$([A-Za-z0-9_]+)[ \t]*/\1/p, property, properties/
--regex-php=/^[ \t]*(const)[ \t]+([A-Za-z0-9_]+)[ \t]*/\2/d, const, constants/
3. phptags -R ,也可以在~/.vimrc 中设置快捷键