vim配置(二):使用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 跳回远处
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。