Ubuntu16.04安装配置和使用ctags
Ubuntu16.04安装配置和使用ctags
by ChrisZZ
ctags可以用于在vim中的函数定义跳转。在ubuntu16.04下默认提供的ctags是很老很旧的ctags,快要发霉的版本(5.9~svn20110310-11),快扔掉它,安装universal-ctags吧!
发霉的exuberant-ctags
来,一起看看,默认的ctags是什么情况。
查看apt提供了哪些ctags包
aptitude search ctags
查询结果:
v ctags -
v ctags:i386 -
i exuberant-ctags - build tag file indexes of source code definitions
p exuberant-ctags:i386 - build tag file indexes of source code definitions
p geany-plugin-ctags - ctags plugin for Geany
p geany-plugin-ctags:i386 - ctags plugin for Geany
p libparse-exuberantctags-perl - exuberant ctags parser for Perl
p libparse-exuberantctags-perl:i386 - exuberant ctags parser for Perl
其中只有exuberant-ctags是apt可安装ctags版本的正确名字。
查看exuberant-ctags版本信息
dpkg -l exuberant-ctags
查询结果:
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============================================================-====================================-====================================-==================================================================================================================================
ii exuberant-ctags 1:5.9~svn20110310-11 amd64 build tag file indexes of source code definitions
看到其中版本号是5.9~svn20110310-11,已经7年没有更新了。这样的包,发霉7年了,扔了吧:
sudo apt remove exuberant-ctags -y
安装新鲜的universal-ctags
universal-ctags是什么?A maintained ctags implementation, https://ctags.io,一个负责的ctags实现,在github上开源并且持续更新和维护。
不多说,快点安装吧:
sudo apt install autoconf
cd /tmp
git clone https://github.com/universal-ctags/ctags
cd ctags
./autogen.sh
./configure --prefix=/opt/software/universal-ctags # 我的安装路径。你按自己的情况调整。
make -j8
sudo make install
把ctags可执行文件更新到系统PATH上?No,我选择创建链接的方式:
# 如果你装了emacs-snapshot,那么现在的ctags命令实际上链接到了/usr/bin/ctags-snapshot,要先删除链接文件:
# sudo rm /usr/bin/ctags
# 然后,把新编译安装的universal-ctags链接过来:
sudo ln -s /opt/software/universal-ctags/bin/ctags /usr/bin/ctags
在vim中配置ctags
关键配置是:
set tags=tags;
set autochdir
放在vim配置文件中。
可以直接用我的vim配置:
cd /tmp
git clone --depth=1 https://github.com/amix/vimrc.git ~/.vim_runtime
sh ~/.vim_runtime/install_awesome_vimrc.sh
git clone https://github.com/zchrissirhcz/dotfiles
cp dotfiles/my_configs.vim ~/.vim_runtime/
使用ctags
cd ~/work/opencv # 随便进入到一个你的c++工程目录
ctags -R . #递归地生成.tags文件
然后在vim中用Ctrl+](跳转到函数定义)和Ctrl+t(跳出定义)。注意,可以多层级嵌套使用,所以这两个操作相当于入栈和弹栈。
enjoy!
===
update@2019-01-14 11:00:25
在tensorflow源码中使用ctags,发现很多C++结构体或函数跳转有问题,没法跳转到定义。这种情况是因为tensorflow很多代码不是C/C++写的,而是protobuf,调用protoc编译器后才生成相应的C/C++代码。很坑。
Ubuntu16.04安装配置和使用ctags的更多相关文章
- Ubuntu16.04安装配置Caffe教程(GPU版)
推荐博客:https://www.linuxidc.com/Linux/2017-11/148629.htmhttps://blog.csdn.net/yggaoeecs/article/detail ...
- Ubuntu16.04 安装配置Caffe
Caffe已经是第三次安装配置了,为什么是第三次呢?因为我实在是低估了深度学习对于硬件的要求.第一次我在自己笔记本上配置的单核,CPU only ... 结果是,样例数据跑了4小时,这还怎么玩?第二 ...
- Ubuntu16.04安装配置sublime text3
1.安装Sublime Text 3 首先添加sublime text 3的仓库: sudo add-apt-repository ppa:webupd8team/sublime-text-3 根据提 ...
- ubuntu16.04 安装配置matlab+python +cuda8.0+cudnn+opencv3.1的caffe环境
网络上有很多ubuntu上caffe配置环境的帖子,本人照着其中的许多进行了参考,都出现了或多或少的错误,很多地方也有差异. 于是自己整理了下自己的安装过程,成功进行了测试,跑通了faster-rcn ...
- Ubuntu16.04安装配置Eclipse 以及opencv的使用
安装配置http://www.oracle.com下载与自己电脑系统对应的JDK.我下载的是jdk-8u101-linux64.tar.gz 解压:sudo tar -zxvf jdk-8u101-l ...
- ubuntu16.04安装配置nagios
参考博文:https://www.howtoing.com/ubuntu-nagios/ 该博文真实有效可供参考,按照步骤,基本可以成功 一.安装的先决条件 sudo apt-get install ...
- ubuntu16.04安装配置mysql数据库,分割视频为帧图像
参考http://wiki.ubuntu.org.cn/MySQL%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97 版本为5.7 一.安装 安装命令sudo apt-get i ...
- Ubuntu16.04安装Redis并配置
Ubuntu16.04安装Redis并配置 2018年05月22日 10:40:35 Hello_刘 阅读数:29146 Ubuntu16.04安装Redis并配置 1):安装: 1:终端命令下载 ...
- Ubuntu16.04安装后开发环境配置和常用软件安装
Ubuntu16.04安装后1.安装常用软件搜狗输入法+编辑器Atom+浏览器Chome+视频播放器vlc+图像编辑器GIMP Image Editor安装+视频录制软件RcordMyDesktop安 ...
随机推荐
- log4j中Logger.getLogger()加载一个类提示错误
转载自:https://blog.csdn.net/q3229270/article/details/77986687 ----------------------------- 错误提示如下:The ...
- delphi 的插件机制与自动更新
delphi 的插件机制与自动更新 : 1.https://download.csdn.net/download/cxp_2008/2226978 参考 2.https://download.cs ...
- 生产环境使用 pt-table-checksum 检查MySQL数据一致性【转】
公司数据中心从托管机房迁移到阿里云,需要对mysql迁移(Replication)后的数据一致性进行校验,但又不能对生产环境使用造成影响,pt-table-checksum 成为了绝佳也是唯一的检查工 ...
- iptables防火墙端口操作
1.将开放的端口写入iptables中,在终端中输入命令: /sbin/iptables -I INPUT -p tcp --dport -j ACCEPT 2.保存上一步的修改内容,输入命令: /e ...
- Centos6.8下SVN安装
1.yum -y install subversion svnserve --version 查看版本 2.@创建SVN仓库目录 mkdir -p /data/svn/repositories 3.@ ...
- 训练报告 (2014-2015) 2014, Samara SAU ACM ICPC Quarterfinal Qualification Contest
Solved A Gym 100488A Yet Another Goat in the Garden B Gym 100488B Impossible to Guess Solved C Gym ...
- Linux root密码忘记了怎么办?
一.找回root密码: 1. 开机出现 Booting Red Hat Enterprise Linux Client (…) in 3 seconds … 按任意键进入menu菜单: 2. 选择当前 ...
- [转]GitHub上优秀的Go开源项目
转载于GitHub上优秀的Go开源项目 正文 近一年来,学习和研究Go语言,断断续续的收集了一些比较优秀的开源项目,这些项目都非常不错,可以供我们学习和研究Go用,从中可以学到很多关于Go的使用.技巧 ...
- 随机生成游戏用户昵称(nodejs版本)(含机器人头像,金币等)
1 前言 有时需要生成随机的用户(或机器人)昵称,头像,金币等,但又不想太生硬,可以现在网上爬一些常见昵称到文本中,然后读取出来,随机使用即可. 2 代码 var nickNameArr = []; ...
- Poco::Crypto--加解密(AES)
Poco::Crypto--加解密(AES) 1 int main(const std::vector<std::string>& args) 2 { 3 /*TO DO*/ 4 ...