Vim and ctags: tag filenames

瘦欲@ 提交于 2020-01-12 06:46:15

问题


Is it possible to have ctags generate tags for filenames as well? I would like to be able to jump to a file given a filename. :find seems to be awfully slow compare to tags...


回答1:


Try running ctags -R --extra=f .

The --extra=f option tells ctags to:

"Include an entry for the base file name of every source file (e.g. "example.c"), which addresses the first line of the file."

When you open vim, you can the use :tag <filename> to jump to the first line of the file.




回答2:


You can open the filename under the cursor with gf

http://vim.wikia.com/wiki/Open_file_under_cursor




回答3:


You can also use cscope:

:cs find f <filename>

or, if you've setup cscope in vim as recommended in :help cscope, put the cursor on top of a filename, and press <C-_>f.




回答4:


Have you tried setting your path and then using vim's 'gf' command?



来源:https://stackoverflow.com/questions/6347982/vim-and-ctags-tag-filenames

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!