emacs向下钻取快捷方式

emacs drill down shortcut

本文关键字:快捷方式 钻取 emacs      更新时间:2023-10-16

我是emacs的新手。在Netbeans中,您可以右键单击任何对象,它会将您直接发送到头文件或实现文件。emacs中有快捷键吗?

您必须首先创建一个TAGS文件。

如果你在linux上:

$ ctags -e -R *.h *.cpp
// this will create tags for all .h and .cpp files, 
// starting from the current directory, and recursing into subdirectories.
// -e : emacs tags (as oposed to vi tags, the default)
// -R : recursive

也可以使用--append标志将添加到现有标记文件中。例如:

$ ctags --append -e -R *.h *.cpp /home/user/jdoe/thirdparty
// This will add to the TAGS file in the current directory

当您想跳转到符号定义时,在emacs中使用M-x find-tagM-.。它会询问TAGS文件在哪里,然后您就设置好了。要弹出,请使用默认映射到M-*M-x pop-tag-mark

注意:ctags是可以的,但由于它不是编译器,有时它会把你带错地方。

您可以使用etags来提供类似的功能。创建TAGS文件后,可以使用M-调用CCD_ 9的快捷方式。

与一切一样:Emacs为您提供了几种方法来做某事,在这种情况下,其中一些方法无法开箱即用。您可以使用etags,或者如果您需要一个非常大的hammer语义,这是cedet项目的一部分。这将为您提供比简单地跳转到头文件更多的功能,但也许这正是您所需要的。