vim + taglist + ctags + cscope 简单使用
来源:互联网 发布:痘印 红 知乎 编辑:程序博客网 时间:2024/05/20 02:28
vim + taglist + ctags + cscope 简单使用
- 博客分类:
- linux
ctags用来跳转, taglist用来列出当前文件的变量, 函数, 宏. cscope用来查找符号
一 使用ctags
1 在源码目录创建tag文件
cd /home/kenby/project/nginx-1.0.0/src
ctags -R
2 打开一个文件
gvim core/ngx_string.c
把光标移到变量名或函数名上,然后按下"Ctrl-]"。用"Ctrl-o"退回原来的地方。
二 使用taglist
打开一个文件, 并输入命令, vim就会产生一栏显示该文件的变量和函数
gvim core/ngx_string.c
:Tlist
三 使用cscope
1 生成 cscope.files
cd /
find /home/kenby/project/nginx-1.0.0/src -name '*.c' -o -name "*.h" > /home/kenby/project/nginx-1.0.0/src/cscope.files
2 生成 cscope.out
cd /home/kenby/project/nginx-1.0.0/src
cscope -b -q -k
这样在源码目录下产生一些 .out 索引文件
3 打开一个文件
gvim core/ngx_string.c
4 添加索引
:cs add cscope.out
5 输入下列命令, 试用cscope强大的查找功能
:cs f c ngx_log_error 查找此函数被哪些函数调用过
:cs f d ngx_log_error 查找此函数调用了哪些函数
:cs f g ngx_log_error 查找变量名或函数名的定义处
:cs f s ngx_log_error 查找该符号出现的地方
:cs f t variable 查找给该变量赋值的地方
四 vimrc配置文件
使用cscope, 每次都输入那么长的命令, 实在很伤手, 在vimrc配置一些快捷键:
if has("cscope")
set csprg=/usr/bin/cscope
set csto=1
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
endif
set csverb
endif
nmap <C-@>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-@>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-@>d :cs find d <C-R>=expand("<cword>")<CR><CR>
- vim + taglist + ctags + cscope 简单使用
- vim+ctags+taglist+cscope
- vim + ctags + cscope+taglist
- vim+ctags+cscope+taglist
- vim+Taglist+cscope+ctags
- vim+ctags+taglist+cscope
- vim + cscope + ctags + taglist
- vim + ctags + cscope + taglist
- vim cscope+ctags+taglist
- vim: ctags cscope taglist使用快速掌握
- 使用 vim + ctags + cscope + taglist 阅读源码
- 使用 vim + ctags + cscope + taglist 阅读源码
- vim + ctags + taglist + cscope + cppcomplete
- ubuntu vim+ctags+taglist+cscope
- vim+ctags+cscope+taglist+nerdtree
- 使用vim进行软件开发(1):vim+ctags+taglist +cscope
- vim + ctags + taglist + cscope + cppcomplete + global 使用初探zz
- vim + ctags + taglist + cscope + cppcomplete + global 使用初探
- 炉石传说【一年记录】
- 头文件为什么要加#ifndef #define #endif
- 快速排序
- no matching editors or conversion strategy found 的解决办法
- 限制系统控制面板方法
- vim + taglist + ctags + cscope 简单使用
- U-BOOT移植过程详解: SPL
- 《深入理解Android:Wi-Fi,NFC和GPS》章节连载[节选]--第二章 深入理解Netd
- Tomcat原理浅谈
- 最简易的权限管理模型 和 标准权限管理模块 和 复杂权限系统
- 通过cocos裁切图片,将大图分为小图
- 2-12 2-13
- Memcached源码分析之内存管理篇
- java学习笔记(四)——classpath