首页 > 代码库 > vim配置(二):使用ctags阅读内核源码
vim配置(二):使用ctags阅读内核源码
1. 安装ctags
root@linux:~# apt-get install ctags
2. 设置内核目录的ctags
root@linux:/study/linux-git/linux-git/linux-3.18.3# ls
arch Documentation include kernel net security
block drivers init lib README sound
COPYING firmware ipc MAINTAINERS REPORTING-BUGS tools
CREDITS fs Kbuild Makefile samples usr
crypto git-test.txt Kconfig mm scripts virt
root@linux:/study/linux-git/linux-git/linux-3.18.3# pwd
/study/linux-git/linux-git/linux-3.18.3
root@linux:/study/linux-git/linux-git/linux-3.18.3# ctags -R
3. 此时在 目录 下生成一个tags文件
root@linux:/study/linux-git/linux-git/linux-3.18.3# ls
arch Documentation include kernel net security virt
block drivers init lib README sound
COPYING firmware ipc MAINTAINERS REPORTING-BUGS tags
CREDITS fs Kbuild Makefile samples tools
crypto git-test.txt Kconfig mm scripts usr
root@linux:/study/linux-git/linux-git/linux-3.18.3#
在vim中执行如下命令使用tags:
set tags=/study/linux-git/linux-git/linux-3.18.3/tags
或者在.vimrc中添加本vim命令,则可以通过ctrl + ] 和ctrl+T跳来跳去了
4. 使用ctags功能
ctrl + ] 跳到定义处
ctrl + T 跳回远处
root@linux:~# apt-get install ctags
2. 设置内核目录的ctags
root@linux:/study/linux-git/linux-git/linux-3.18.3# ls
arch Documentation include kernel net security
block drivers init lib README sound
COPYING firmware ipc MAINTAINERS REPORTING-BUGS tools
CREDITS fs Kbuild Makefile samples usr
crypto git-test.txt Kconfig mm scripts virt
root@linux:/study/linux-git/linux-git/linux-3.18.3# pwd
/study/linux-git/linux-git/linux-3.18.3
root@linux:/study/linux-git/linux-git/linux-3.18.3# ctags -R
3. 此时在 目录 下生成一个tags文件
root@linux:/study/linux-git/linux-git/linux-3.18.3# ls
arch Documentation include kernel net security virt
block drivers init lib README sound
COPYING firmware ipc MAINTAINERS REPORTING-BUGS tags
CREDITS fs Kbuild Makefile samples tools
crypto git-test.txt Kconfig mm scripts usr
root@linux:/study/linux-git/linux-git/linux-3.18.3#
在vim中执行如下命令使用tags:
set tags=/study/linux-git/linux-git/linux-3.18.3/tags
或者在.vimrc中添加本vim命令,则可以通过ctrl + ] 和ctrl+T跳来跳去了
4. 使用ctags功能
ctrl + ] 跳到定义处
ctrl + T 跳回远处
vim配置(二):使用ctags阅读内核源码
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。