Emacs 文件导航
当我不确定文件的确切位置时,我使用 emacs .
命令来导航目录树。我的问题是:当我关闭给定文件时,我回到了目录的顶部。
有谁知道如何关闭文件并返回到目录树中的当前分支?
I use the emacs .
command to navigate a directory tree when I am not sure exactly where a file is. My problem is: When I close a given file, I am back at the top of the directory.
Does anyone know a way to close a file and go back to the current branch in the directory tree?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这需要 emacs 能够更改 shell 的当前工作目录,但这是不可能直接实现的。
作为解决方法,您可以使用 emacs 内置的 shell(有多种变体)。
That would require emacs to be able to change the current working directory of your shell, which isn't directly possible.
As a workaround, you can use the shell built into emacs (there are several variants).
Cx Cv
将提示您输入一个文件,从与活动缓冲区中的文件相同的目录开始。选择新文件后,它将关闭旧文件并用新文件替换它。这符合你的要求吗?C-x C-v
will prompt you for a file, starting in the same directory as the file in the active buffer. After you pick a new file, it will close the old file and replace it with the new one. Does that do what you want?我使用 ido 包来打开文件。当我打开一个文件并点击
Cx Cf Cd
(打开文件然后Cd)时,它将在该文件的目录中打开dired。这能解决你的问题吗?I use the
ido
package to open files. When I have a file open and hitC-x C-f C-d
(open file then C-d) it will open up dired in that file's directory. Will that solve your problem?仅仅停止关闭文件是不值得的。如果您在一天结束时关闭 emacs,那么文件无论如何都会被关闭。否则,您可以使用 午夜模式 定期清理未使用的缓冲区。
Simply stop closing files it's not worth the effort. If you shut down emacs at the end of the day then the files will be closed anyway. Othewise you can use midnight mode to regularly clean up unused buffers.