首先安装cscope [root@cutbag sys]#tar jxvf cscope-15.7a.tar.bz2[root@cutbag sys]#cd cscope-15.7a[root@cutbag.../configure --enable-cscope --prefix=/usr[root@cutbag sys]#make&&make install 然后安装ctags [root@cutbag...-name "*.c" -o -name "*.h" -o -name "*.cpp" > cscope.filescscope -Rbkq -i cscope.filesctags -R Written
/cscope.filescscope -Rbkq即可。...If it wasn't, time to recompile vim... if has("cscope") """"""""""""" Standard cscope/vim boilerplate..." use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t' set cscopetag " check cscope for...("cscope.out") cs add cscope.out " else add the database pointed to by environment variable...elseif $CSCOPE_DB !
[root@btg linux-2.6]# vim [1]+ Stopped vim [root@btg linux-2.6]# vim fs/ext2/super.c [2]+ Stopped...[root@btg linux-2.6]# [root@btg linux-2.6]# jobs [1] Stopped vim [2]- Stopped vim fs/ext2/super.c...-dl -f cscope.out root 17471 0.0 0.1 14424 3404 pts/1 T 14:02 0:00 vim fs/ext2/inode.c root 17472 0.0...0.0 3932 1808 pts/1 T 14:02 0:00 /usr/bin/cscope -dl -f cscope.out root 19174 3.0 0.0 6416 1016 pts/...0.0 0.0 3932 1808 pts/1 T 14:02 0:00 /usr/bin/cscope -dl -f cscope.out 使用如下命令 [root@btg P5906]# kill
阅读c++代码中,我门在linux上直接vim打开,简单的搜索"/"搜索关键词。这个搜索出来的类似有Find查找。但其实在c++代码中有个更高级的功能-符号解析器。...cscope。...接着我们进入到c++工程目录,执行cscope -b -c -R, 这时候cscope会去解析符号以及他们之前的联系,会生成一个cscope.out代码符号文件。.../cscope.out加载工程项目符号索引数据库。...但是注意有几个事情cscope不能实现。 cscope生成的cscope.out数据库是包含当前目录的所有符号,他不能限定查找范围为某个子目录,这个像vscode之类的IDE是有这个功能。
知道了一个网站 http://kernelnewbies.org,一些FAQ , 摘录如下 (1) Code Browsing a) cscope,tags 原来内核中有生成 cscope和tags...的脚本 make cscope make tags 给make加上V=1,可以看到哪些命令被执行。...$ make cscope V=1 /bin/bash linux-2.6.32.63/scripts/tags.sh cscope ..... + cscope -b -f cscope.out...cd linux-2.6.32 cp /boot/config-`uname -r` ./.config make menuconfig make make modules sudo
Ctrl + + 为增大字体 2.4 cscope 2.4.1 cscope安装配置 先看下ctags和cscope的区别: ctags can be used to take you to the definition...表示安装成功 2.4.2 cscope使用 第1步:使用 cscope 生成数据库文件 cscope -Rbkq 其中参数的含义: -R 递归,对子目录也建立数据库 -b 只生成数据库,不进入 scope...4.结束语 本期相关的资料在https://github.com/TopSemic/NUC972_Linux Lesson19中。...本篇为大家介绍了Linux下使用vim配合4个插件实现Linux代码的高效阅读,因为我也是刚学习,所以肯定有很多更好的使用方法还没有掌握,欢迎大家多交流,共同进步,可以在网页下方留言讨论,或者发邮件:...想要获取本文pdf版本的,关注公众号后,回复linux19,即可获取。
一般来说,如果我们想要研究一个c/c++项目的源码,我们首先要做的是为该项目生成tags文件,linux内核是c写的,所以它也不例外。...tags文件种类有很多,比如 ctags、etags、cscope、gtags 等,有关他们的区别可以参考下面链接里的内容: https://github.com/oracle/opengrok/wiki.../Comparison-with-Similar-Tools 根据我的测试,gtags是最好用的,其官方地址是: https://www.gnu.org/software/global/ 由于linux...那怎么办呢,其实linux的Makefile里已经帮我们写好了如何生成各种tags,看下面的命令: $ make help # 省略其他 tags/TAGS - Generate tags...file for editors cscope - Generate cscope index gtags - Generate GNU GLOBAL index
modules_prepare - Set up for building external modules tags/TAGS - Generate tags file for editors cscope...- Generate cscope index gtags - Generate GNU GLOBAL index kernelrelease - Output...tarball perf-tarxz-src-pkg - Build perf-2.6.39-rc3.tar.xz source tarball Documentation targets: Linux.../README file [root@btg ext4]# [root@btg ext4]# make tags cscope GEN tags GEN cscope...[root@btg ext4]# 我自己生成的cscope和tags打开的内容 Cscope tag: start_kernel # 行 文件名 / 上下文 / 行 1
但是对于Linux下的C/C++的 程序员,使用VIM+Ctags的组合来写程序也许是最佳的选择。^_^ 尽管ctags也可以支持其它编辑器,但是它正式支持的只有VIM。...在VIM中使用cscope非常简单,首先调用“cscope add”命令添加一个cscope数据库,然后就可以调用“cscope find”命令进行查找了。...要使用cscope查找就必须加载cscope.out文件.在vim命令行下执行:(按照上述方法配置好的vimrc中有这一步) :cs add cscope.out 在vim命令行下执行: :cs...连UltraEdit和EditPlus都没用过的同学问:它们就相当于Linux上的 Notepad吧?我说:请你从我的眼前消失。...●Linux之父Linus多年来用的是一款 MicroEmacs,它比GNU Emacs或XEmacs少许多功能,但Linus就是用它在维护Linux。
@ubuntu:~/arm$ cd linux-2.6.24.7 lingd@ubuntu:~/arm/linux-2.6.24.7$ ls arch crypto include.../tags表示在当前工作目录下搜索tags文件 set tags+=~/arm/linux-2.6.24.7/tags表示在搜寻tags文件的时候,也要搜寻~/arm/linux-2.6.24.7/文件夹下的...cscope.out elseif $CSCOPE_DB !...数据库 lingd@ubuntu:~/arm/linux-2.6.28.7$ cscope -Rbq lingd@ubuntu:~/arm/linux-2.6.28.7$ ls cscope.* cscope.in.out... cscope.out cscope.po.out 、用vim打开某个源码文件,末行模式下,输入“:cs add cscope.out"(该命令已被我们映射为快捷键F4),添加cscope数据库到
huge --enable-rubyinterp --enable-pythoninterp --with-python-config-dir=/usr/lib/python2.7/config-i386-linux-gnu.../ --enable-perlinterp --enable-gui=gtk2 --enable-cscope --enable-luainterp --enable-perlinterp --enable-multibyte...Vim对lua编写的插件的支持 --enable-perlinterp:启用Vim对perl编写的插件的支持 --enable-multibyte:多字节支持 可以在Vim中输入中文 --enable-cscope...:Vim对cscope支持 --enable-gui=gtk2:gtk2支持,也可以使用gnome,表示生成gvim --with-python-config-dir=/usr/lib/python2.7.../config-i386-linux-gnu/ 指定 python 路径 --prefix=/usr:编译安装路径 3.编译安装 sudo make VIMRUNTIMEDIR=/usr/share
如果在编辑过程中文件发生外部改变(比如被别的编辑器编辑了),就会发出提示 持续更新… vim博大精深,先看看有哪比较使用的vim插件 Linux 为源代码生成ctags: 1.sudo.../linux-5.x.x 2.生成tags文件,根目录执行ctags -R xxx(xxx为需要生成tags的文件目录) 3.vim -t tags(tags替换为想要查找查找的变量或函数名...-t miscdevice 其他指令: ctrl + ] 跳转到贯标所在函数或者结构体的定义处 ctrl + T 返回查找或跳转 ctrl + G 查看当前vim打开文件和文件路径 Linux...为源代码生成cscope: 1.sudo apt-get install cscope安装vim插件 2.cd到代码根目录并执行命令 cscope -Rbq生成索引库 3.vim中添加cscope.out...,: cs add cscope.out vim支持8种cscope的查询功能:cs find -s tags 命令 说明 s 查找C语言符号,即查找函数名、宏、枚举值等出现的地方 g 查找函数、宏、
比如说对linux kernel的代码做研究(举个例子,我真正做的不是这个),我想知道一个个数据包在kernel里走过的全部流程,然后以此绘制热点图,Petri Net等等。...对这个需求点,我需要的「轮子」有: (1) systemtap,一个linux下媲美DTrace的probing工具。...人在紧急情况下会产生「急智」,就好像突然开窍一般,我突然想到了用cscope生成的索引文件cscope.out。...使用过cscope的人大多是用vim/emacs或者直接"cscope -d"使用,我想99%的人不知道cscope还能这么用: $ cscope -d -L2 # print...使用cscope.out的另外一个好处是对代码的分析可以脱离代码本身,任何一个装有cscope的环境就可以进行分析。
:打开对lua编写的插件的支持 --enable-perlinterp:打开对perl编写的插件的支持 --enable-multibyte:打开多字节支持,可以在Vim中输入中文 --enable-cscope...:打开对cscope的支持 --enable-fontset 字体设置 --with-python-config-dir=/usr/lib64/python2.7/config #指定python2路径...--with-python-config-dir=/usr/local/lib/python3.7/config-3.7m-x86_64-linux-gnu #指定python3路径 --prefix...local/vim:指定将要安装到的路径 查找python3配置文件路径 注意:如果您使用的是Python,则您的config目录可能具有特定于计算机的名称(例如config-3.5m-x86_64-linux-gnu.../configure --with-features=huge \ --enable-multibyte \ --enable-cscope \ --enable-pythoninterp=yes \
下载cscope_maps.vim,放到Vim的plugin目录。 修改_vimrc,让查找结果显示在quickfix窗口而不是主窗口。..."cscope show in quickfix set cscopequickfix=s-,c-,d-,i-,t-,e- 好了,配置完成,下面我们看看怎么用。...在vim中输入:help if_cscop.txt可以看到关于Cscope的帮助。 看完文档,我们可以在vim中输入命令:cs find c foo用来查找foo方法在哪里被调用过。...cscope_maps.vim映射了一些键盘的快捷键,我们可以快捷的使用查找功能。...启用Grep,在工程中查找 Grep是linux中命令,如果你不熟悉可以看Grep的文档。
最近在搞linux,没有好用的IDE,想到了VIM. 配置 了下VImrc文件。发现挺好用的。这里总结下使用方法。 首先环境准备,下载windows下的VIM .GVIM。我的版本是V7.4....自动的会去执行ctag和cscope指令,生成相关的配置。 至于快捷键,这里不介绍了。直接查看_vimrc文件即可。想添加新功能,新快捷键,直接编辑这个文件即可。...关于vim,有个吐槽是快捷键像 复制粘贴等,在linux和windows下都通用的,但vim不行。其实配置下也是可以的。...if has("cscope") set csprg=cscope csto=0 cst nocsverb if filereadable("cscope.out") " add any database...in current directory cs add cscope.out elseif $CSCOPE_DB !
/*cscope从cscop.files读入文件然后建立链接*/ cscope -bkq -i cscope.files ctags -R 这个脚本执行完会在当前文件夹生成几个cscope...."" " cscope 自动加载cscope.out文件 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" if has("cscope...cscope.out elsewhere else let cscope_file=findfile("cscope.out",".;") let cscope_pre...") cs add cscope.out "else search cscope.out elsewhere else let cscope_file...=findfile("cscope.out",".;") let cscope_pre=matchstr(cscope_file,".*/") if !
usr/bin/lua5.3 /usr/bin/lua sudo ln -s /usr/include/lua5.3 /usr/include/lua sudo ln -s /usr/lib/arm-linux-gnueabihf.../liblua5.3.so /usr/local/lib/liblua.so # 修复python位置 sudo ln -s /usr/lib/python2.7/config-arm-linux-gnueabihf.../usr/lib/python2.7/config sudo ln -s /usr/lib/python3.4/config-3.4m-arm-linux-gnueabihf /usr/lib/python3.4...enable-pythoninterp=dynamic \ --enable-perlinterp=dynamic \ --enable-rubyinterp=dynamic \ --enable-cscope...config-3.7m-darwin \ --enable-luainterp \ --with-lua-prefix=/usr/local/Cellar/lua/5.3.5_1 \ --enable-cscope
1.1环境 OS:CentOS Linux release 7.6.1810 (Core) python版本:Python 3.9.6 需求:配置vim使能支持python程序开发的类似IDE环境,实现代码不全...> Compiled by …… +cryptv +linebreak +python/dyn +viminfo +cscope...]# python Python 2.7.5 (default, Apr 2 2020, 13:16:51) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2...sys >>> sys.path ['', '/usr/lib64/python27.zip', '/usr/lib64/python2.7', '/usr/lib64/python2.7/plat-linux2...# python Python 3.9.6 (default, Jul 21 2021, 17:15:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
集成了ctag和cscope等工具,支持函数跳转。 先来截个图: 新手之所以感觉vim不方便,一是需要入门学习,另一点就是想要个好用强大点儿的配置,需要自己安装配置各种插件。...(支持函数跳转有个前提条件:首次在项目的根目录位置使用vim打开文件后,需要执行一个:SrcInit()函数,然后按回车键,这样会自动触发ctag和cscope命令行工具工作。)...if has("cscope") set csprg=cscope csto=0 cst nocsverb if filereadable("cscope.out") " add any database...in current directory cs add cscope.out elseif $CSCOPE_DB !...-Rb -v" " let cmd = "cscope -Rb -v -s " " let cmd = cmd . a:path."
领取专属 10元无门槛券
手把手带您无忧上云