在 Emacs 中查找文件的快速方法?
每次我在 Aquamacs 或 Emacs 中使用 find-file 时,它都会自动显示上一个目录,例如 ~/Work/abc/cdf。但是,如果我想从 ~ 目录中打开某些内容,我必须一直按删除键直到第一个字符。有没有什么快速方法可以只用一两个键替换所有字符串?
先感谢您。
Every time I use find-file in Aquamacs or Emacs, it auto shows the previous directory, for example ~/Work/abc/cdf. However, if I want to open something from the ~ directory, I have to press Delete all the ways down to the first character. Is there any quick way to replace all the string with just one or two keys?
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
不,您不需要(必须按删除键)。只需输入 ~,emacs 就会忽略它之前的所有内容。与/相同。
No, you don't (have to press Delete). Just type ~ and emacs will ignore everything before it. Same with /.
是的,当仍在迷你缓冲区中时,按 Ctrl-A 转到文件名路径的开头,然后按 Ctrl-K 将其删除到行尾,现在您的文件路径为空,您只需键入“~” ”
Yes, while still in the mini buffer press Ctrl-A to go to the start of the file name path, and Ctrl-K to delete it to the end of the line, now your file path is empty and you can just type "~"
正如 harpo 已经指出的那样,只需输入 ~ 即可快速更改到主目录。更一般地说,您可以通过激活 ido-mode。
As harpo has already noted, just entering ~ will do the job for changing to home directory quickly. More generally, you can get a lot of improvements for quicker navigation in find-file by activating ido-mode.
M-
(backward-kill-word)应该在每个目录级别按一次
Cx
(backward-kill-sentence)可以工作,但是还删除了 ~/
您当然可以定义自己的命令和 emacs lisp 来实现它们。
作为一种替代方法,许多 UNIX 会让您只需在预填充路径后键入 ~/ ,然后将所需的路径放在后面, ~/ 会覆盖之前的所有内容。
how about
M-<DEL>
(backward-kill-word)Should take one press per directory level
C-x <DEL>
(backward-kill-sentence)works but also wipes out the ~/
You can of course define your own commands and the emacs lisp to implement them.
As an alternate approach, many unixes will let you simply type a ~/ after the prefilled path and put your desired path after that, the ~/ overriding everything that came before.
有一些软件包可以为您做到这一点,例如:
http://www.emacswiki .org/emacs/minibuf-electric-gnuemacs.el
There are packages that does that for you, for example:
http://www.emacswiki.org/emacs/minibuf-electric-gnuemacs.el