yum install ctags
Package ctags-5.8-13.el7.x86_64 already installed and latest version
创建 /home/mzh/pptp-master/tags.sh
#!/usr/bin/sh
WORKDIR=/home/mzh/pptp-master
find ${WORKDIR} -name "*.[c|h]" | xargs ctags -f ${WORKDIR}/tags
find /usr/include -name "*.h" | xargs ctags -a ${WORKDIR}/tags
cd /home/mzh/pptp-master/
chmod a+x ./tags.sh
./tags.sh # 生成tags文件
再编辑 ~/.vimrc
set ts=4
set sw=4
set tags=/home/mzh/pptp-master/tags
如果要切换项目, ; set tags=/home/mzh/pptp-master/tags 注释掉,再加一行用其他项目的tags
[mzh@vultr pptp-master]$ grep -rn "int main(" .
./pptp.c:190:int main(int argc, char **argv, char **envp)
./tags:139670:main /home/mzh/pptp-master/pptp.c /^int main(int argc, char **argv, char **envp)$/;" f
要查找get_ip_address的定义,光标移动过去。按Ctrl + ] 跳转
Ctrl + t 跳回来
pptp-master
vultr云主机