Linux下配置vim-配置ctags

【配置ctags】

    假设你要编译的源代码目录位置为:/worksapce/weather

    执行下面操作,生成tags标签文件:

  
  
[root@ericsson:/workspace/weather]#pwd /workspace/weather [root@ericsson:/workspace/weather]#ls dispacth.cpp dispacth.h main.cpp [root@ericsson:/workspace/weather]#ctags -R * [root@ericsson:/workspace/weather]#ls dispacth.cpp dispacth.h main.cpp tags

    vim的配置文件有下面三个:

        system vimrc file: "/etc/vimrc"
        user vimrc file: "$HOME/.vimrc"
        user exrc file: "$HOME/.exrc"

    我本机配置vim是针对全局的,所以修改/etc/vimrc文件,在文件最后添加下面内容:

  
  
set tags=/workspace/weather/tags

       如果有多个tags文件则用逗号隔开(tags文件名可以相同),设置完tags变量之后,使用如下:

  
  
[root@ericsson:/workspace/weather]#ls a.out dispacth.cpp dispacth.h main.cpp tags [root@ericsson:/workspace/weather]#vi -t ttcs

    ttcs是函数名,被定义在main.cpp,如果ctags安装配置正确,则会自动跳到该函数定义处,如果有多个函数,则会出现一个列表。如果

出现:“E257: cstag: tag not found ”,建议重新到代码目录,运行:ctags -R *


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值