使用find命令创建ctags(用于代码导航)

发布于 2024-12-28 10:15:26 字数 294 浏览 5 评论 0原文

我有一个项目的大型代码存储库,我正在尝试通过 emacs 标签对其进行搜索。因此,我进入主目录,尝试使用此命令生成标签:

find . -name *.[chsS] | xargs etags -

但是我得到响应“find:No match”。

当我单独键入“查找”命令时,它会列出所有代码文件和子目录,其中包含我希望标记的更多代码文件。

我怎样才能做到这一点?澄清一下,我希望能够使用 emacs M-。和 M-* 在大型存储库中浏览代码标签。

非常赞赏。

I have a big code repository for a project and I'm trying to make it searchable via emacs TAGS. So I go into the main directory and I try using this command to generate the tags:

find . -name *.[chsS] | xargs etags -

However I get the response "find: No match."

When I just type the "find" command on its own, it lists all the code files and subdirectories with more code files that I wish to tag.

How can I make this work? Just to make clear, I want to be able to use the emacs M-. and M-* to navigate around code tags in a big repository.

Greatly appreciated.

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

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

发布评论

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

评论(3

貪欢 2025-01-04 10:15:26

我打电话给 shannanigans ,因为您声称这有效:

find . -name *.[chsS]

在这里,您的交互式 shell 会将“*.[chsS]”扩展为文件列表,并且第一个文件将被接受作为“name”参数。但 find 会尝试将第二个文件解释为选项,并且它无效。

这里的教训是用单引号、双引号或反斜杠引用传递的通配符来查找。

I call shannanigans on your claim that this works:

find . -name *.[chsS]

Here, your interactive shell would expand "*.[chsS]" into a list of files, and the first one would be accepted as the "name" parameter. But find will try to interpret the second file as an option, and it won't be valid.

The lesson here is to quote wildcards passed to find either with single-quotes, double-quotes, or backslash.

逆流 2025-01-04 10:15:26

对于使用 ctags 工具的 C 和头文件,

find . -name \*.[ch] | xargs ctags

此命令将包含扩展名为 .c.h 的源文件

For C and header files using ctags tool,

find . -name \*.[ch] | xargs ctags

This command will include the source file with extension .c and .h

花间憩 2025-01-04 10:15:26

如果您使用 https://ctags.io 开发的 ctags

ctags --languages=C,Asm --kinds-C=+p -e -R  

可能会生成 TAGS 文件。

If you use ctags developed at https://ctags.io

ctags --languages=C,Asm --kinds-C=+p -e -R  

may generate TAGS file.

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