There are many ways to do this, as listed in vim wiki.
I tried the script way (a.vim), but not feel comfortable. Because:
1) I’m doing kernel development, so I have a bunch of my own stdio.h, stdlib.h, etc. But a.vim will bring you into the system include path, not my own.
2) Even though I jumped to the right space, jump back is not easy…
Finally, I found the ctags way very usable. Issue this command in your source tree root,
$ctags --extra=+f -R .
Then in vim, you can just type
:tag header.h to jump to header.h and use your familiar
ctrl+t to jump back, very intuitive.
Plus, I found a
gf command of vim that can jump to the file under cursor, but with the same drawbacks as a.vim, thus not adorable.