標籤:
1. 安裝ctags
[email protected]:~# apt-get install ctags
2. 設定核心目錄的ctags
[email protected]:/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
[email protected]:/study/linux-git/linux-git/linux-3.18.3# pwd
/study/linux-git/linux-git/linux-3.18.3
[email protected]:/study/linux-git/linux-git/linux-3.18.3# ctags -R
3. 此時在 目錄 下產生一個tags檔案
[email protected]:/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
[email protected]:/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閱讀核心源碼