ctags

Can ctags be made to follow #include directives?

守給你的承諾、 提交于 2019-12-12 07:39:51
问题 I am trying to create a target in my Makefile to automatically create a tags file using ctags. I have a list of source files (.cpp files) but I don't have a list of all the header files (I use g++ -MM to create the list of header dependencies). I would have assumed that ctags would follow any #include directives in the .cpp files when generating the tags, but it seems my assumption is wrong. If I create a simple tags file like this: ctags --fields=+iaS --extra=+q myClass.cpp and then go into

Synergy between ctags and cscope

孤街醉人 提交于 2019-12-11 23:26:48
问题 I've used both cscope and ctags to collectively help browse the C code previously. Now with C++ code, I'm trying to use them to aid in code browsing. This is how the cscope and ctags DBs have been built: $ find . -name '*.cc' -o -name '*.h' > cscope.files $ cscope -b $ ctags -L cscope.files Invoking cscope: $ cscope -d Once I search for a symbol and open the relevant file from within cscope, I'm unable to find definitions of other symbols using . The error is: E433: No tags file E426: tag not

Understanding the ctags file format

守給你的承諾、 提交于 2019-12-11 08:49:27
问题 I used "Exhuberant ctags" to index all the tags from my c-project. The c-project is embedded software for a Cortex-M7 microcontroller. The result is a tags-file. I'm trying to read this file and understand what is written down. Based on the documentation I find for ctags and Exhuberant ctags, I can grasp the meanings of most lines. For example: ADC3 .\Drivers\CMSIS\Device\ST\STM32F7xx\Include\stm32f767xx.h 1525;" d This line means: A tag has been found with name ADC3 . The tag is found in

ctags chokes on source file with unbalanced braces due to #ifdef

你。 提交于 2019-12-11 02:44:58
问题 I am using ctags to generate a tags file for a C project I am working on, but many functions are missing in the file. This appears to be caused by unbalanced braces in the source files due to using #ifdef . A (simplified) example: #include <stdio.h> struct mystruct { long member; #ifndef _MSC_VER }__attribute__ ((packed)); #else /* _MSC_VER */ }; #pragma pack(pop) #endif /* _MSC_VER */ char* greeting_text(){ return "Hello world\n"; } int main( int argc, const char* argv[] ){ char * greeting =

Display current function in vim status line

微笑、不失礼 提交于 2019-12-10 15:23:07
问题 I spend 20% of my life writing code in vim, almost exclusively javascript and python. The other 80% of the time I am mostly scrolling up and down my source file, trying to remember which function I'm currently editing and what class the function belongs to. This may be technically impossible for reasons I don't understand, but are there any vim plugins which allow the vim status line to show the function the cursor is currently in for Python and/or Javascript? It would look like this: It's

Ubuntu下创建vim+Taglist+cscope+ctags组合编辑器

守給你的承諾、 提交于 2019-12-10 06:33:39
有人抱怨Linux系统下没有类似于VC之类的方便快捷的编辑器,有人用gedit, 有人用vim,但是都不方便而且也没有自动补全之类的方便用户的功能。本文简单介绍使用vim中的几个插件(Ctags、Cscope和TagList) 实现一个强大的编辑器,希望可以帮助您学习、使用。 一、软件安装 Ubuntu给我们安装软件提供了很大的便利,比如说, 安装vim 我们可以直接使用" sudo apt-get install vim "即可安装! 同样, cscope和ctags也可以使用相同方法安装 ,这是多么畅快淋漓啊!感谢Ubuntu给我们用户如此便利! 对于 Taglist 使用这个方法安装不了,我们需要先下载,然后安装完成: 首先上网 下载Taglist插件 ,下载完成后解压,再将文件下的taglist.vim使用cp命令拷贝到HOME/.vim/plugin文件夹下(cp -r taglist.vim ~/.vim/plugin) 这样,vim+Taglist+cscope+ctags四种工具我们是安装好了,但是如何使用呢? 二、Vim简介及配置 vim 是一个非常好用的编辑工具,以下介绍几个常用的底行模式命令: (1). 设置缩进 :set smartindent // 设置缩进 :set smartindent shiftwidth=4 // C语言自动缩进

Vim编程之:tags,cscope,taglist

血红的双手。 提交于 2019-12-10 06:22:43
最近VIM用得比较多,所以在学了不少。在这里对收获到的东西做一个总结。 1.编程四要素vim,ctags,cscope,taglist vim配合这3件东西之后,极为强大。与SourceInsight有一拼。 1.1 ctags ctags叫作“标签”,它记录源码中所有标识符定义所在的文件与行号。 (1)安装 先在命令终端运行一下: $ ctags --version 看一下当前系统有有没有安装ctags,如果有就跳过本节。 我是在 http://ctags.sourceforge.net/ 上下载的最近的源码,解压,配置,编译,安装。 $ tar zxvf ctags-5.8.tar.gz $ cd ctags-5.8 $ ./configure && make ... $ sudo make install 然后再检查一下是否成功安装 $ ctags --version 通常是没问题的。 (2)使用 在咱们的源码目录下执行简单的 $ ctags -R . ctags就会遍历当前目录下的所有.c,.h,.cpp文件,提取所有的标识符并记录到tags文件中。 进入vim可又使用标签参数,使vim打开时跳到标签所在位置。如果我们要找WinMain,如下: $ vi -t WinMain 进行vim之后,常用的几个命令: :tag {ident} "跳转到ident标签位置上

使用 vim + ctags + cscope + taglist 阅读源码

不打扰是莪最后的温柔 提交于 2019-12-10 06:17:56
最近,准备跟学长一起往 linux kernel 的门里瞧瞧里面的世界,虽然我们知道门就在那,但我们还得找到合适的角度才会看得更舒服,对吧^_^ 。 阅读源码的工具有很多,而且如今的集成开发环境(IDE)也很强大,但对于经常使用vim编辑器的程序员来说,对vim的强大绝对是“不抛弃,不放弃”的,况且 我们 只要安装一些插件配合vim的工作一样能达到IDE的效果, 好了,废话少说。浏览了很多有关的网页资源后,发现有很多插件可以用,但 在此推荐3款比较常用的“小”插件供大家参考,它们其实并不“小”,非常强大!一般地,只是单个小程序源码的阅读就不必劳驾插件了(我是这样认为的),对于工程代码不用它们就有点困难了。 这三个插件分别是: ctags , cscope , taglist 先看看效果如何吧 在ubuntu下的安装与配置如下—— (1) ctags 插件 a) 功能: 对浏览代码非常的方便, 可以在函数, 变量之间跳来跳去等等等等 (更多说明请百度或谷歌一下) b) 安装配置: 终端下输入 sudo apt-get install ctags 如果没发现该软件包就用 sudo apt-get install exuberant-ctags 就行了…… 如果还不行可以到官网下载源码手动编译安装,有点麻烦是不是?不要嫌麻烦,这也是一个学习的机会,如果遇到其他类似的你也可以仿照这里的例子

使用 vim + ctags + cscope + taglist 阅读源码

半城伤御伤魂 提交于 2019-12-10 06:13:47
阅读源码的工具有很多,而且如今的集成开发环境(IDE)也很强大,但对于经常使用vim编辑器的程序员来说,对vim的强大绝对是“不抛弃,不放弃”的,况且 我们 只要安装一些插件配合vim的工作一样能达到IDE的效果, 好了,废话少说。浏览了很多有关的网页资源后,发现有很多插件可以用,但 在此推荐3款比较常用的“小”插件供大家参考,它们其实并不“小”,非常强大!一般地,只是单个小程序源码的阅读就不必劳驾插件了(我是这样认为的),对于工程代码不用它们就有点困难了。 这三个插件分别是: ctags , cscope , taglist 先看看效果如何吧 在ubuntu下的安装与配置如下—— (1) ctags 插件 a) 功能: 对浏览代码非常的方便, 可以在函数, 变量之间跳来跳去等等等等 (更多说明请百度或谷歌一下) b) 安装配置: 终端下输入 sudo apt-get install ctags 如果没发现该软件包就用 sudo apt-get install exuberant-ctags 就行了…… 如果还不行可以到官网下载源码手动编译安装,有点麻烦是不是?不要嫌麻烦,这也是一个学习的机会,如果遇到其他类似的你也可以仿照这里的例子,再配合压缩包里的README文件就能手动安装了,你说是不是,呵呵。 下载地址 http://nchc.dl.sourceforge.net

Using multiple tag files at once in vim / Tag organisation in general

…衆ロ難τιáo~ 提交于 2019-12-09 13:15:14
问题 (Apologies for the C tag, I did it for the syntax highlighting. This is more of a vim question. If someone more learned than I thinks the tag should be removed please do so) Say I've got this directory structure: Directory ~/Code/Test/ containing file1.c file2.c file4.c and Sub Directory ~/Code/Test/Sub/ containing file3.c file1.c: #include <stdio.h> #include "file2.c" #include "Sub/file3.c" void function1(); int main (int argc, char *argv[]) { function1(); function2(); function3(); return 0;