Vim 和 ctags:标记文件名

发布于 2024-11-15 22:12:35 字数 69 浏览 4 评论 0原文

是否也可以让 ctags 为文件名生成标签?我希望能够跳转到给定文件名的文件。 :find 与标签相比似乎非常慢......

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...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

雪落纷纷 2024-11-22 22:12:35

尝试运行 ctags -R --extra=f 。

--extra=f 选项告诉 ctags:

“包含每个源文件的基本文件名条目(例如“example.c”),它寻址文件的第一行。”

当你打开vim时,你可以使用 :tag 跳转到文件的第一行。

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.

昔日梦未散 2024-11-22 22:12:35

您可以使用 gf 打开光标下的文件名

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

You can open the filename under the cursor with gf

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

灵芸 2024-11-22 22:12:35

您还可以使用 cscope

:cs find f <filename>

或者,如果您按照 :help cscope 中的建议在 vim 中设置了 cscope,请将光标放在文件名上,然后按 f

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.

羁〃客ぐ 2024-11-22 22:12:35

您是否尝试过设置路径然后使用 vim 的“gf”命令?

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文