Dired模式单窗口? (emacs)

发布于 2024-08-23 15:14:51 字数 221 浏览 8 评论 0原文

有没有一种方法可以在单个窗口中进行 dired 操作,这样当我遍历目录时,中间目录就没有 n 个 dired 缓冲区?但是 - 如果我在一个完全独立的目录中启动另一个 dired 缓冲区(从迷你缓冲区而不是在已经打开的 dired 实例中的子目录上点击 [enter]),我想保留两个单独的 dired 缓冲区...我想我因为我打开了 ido-mode,所以正在使用 ido-dired,但我不知道解决方案会有所不同?非常感谢!

is there a way to have dired operate in a single window so that when I traverse through directories I don't have n number of dired buffers for the intermediate directories? However - if I start another dired buffer in a completely separate directory (from the minibuffer rather than hitting [enter] on a subdirectory in an already open dired instance) I'd like to retain the two separate dired buffers... I guess I'm using ido-dired since I have ido-mode on but I don't know that the solution would be different? Thanks much!

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

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

发布评论

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

评论(5

清眉祭 2024-08-30 15:14:52

像这样?

(defadvice dired-find-file (around kill-old-buffer activate)
    "When navigate from one dired buffer to another, kill the old one."
    (let ((old-buffer (current-buffer))
          (new-buffer (dired-get-filename))) 
      ad-do-it
      (kill-buffer old-buffer)
      (switch-to-buffer new-buffer)
))

Like this?

(defadvice dired-find-file (around kill-old-buffer activate)
    "When navigate from one dired buffer to another, kill the old one."
    (let ((old-buffer (current-buffer))
          (new-buffer (dired-get-filename))) 
      ad-do-it
      (kill-buffer old-buffer)
      (switch-to-buffer new-buffer)
))
请止步禁区 2024-08-30 15:14:52

如果您主要想让每个 dired 缓冲区与同一层次结构下的各个子目录一起工作(例如,为多个正在进行的项目中的每一个项目分配一个 dired 缓冲区),您可以使用内置的 i (< em>dired-maybe-insert-subdir) 和 k (dired-do-kill-lines 位于插入的子目录的标头上,以将其从缓冲区)命令。它们将允许您在单个目录缓冲区内编辑多个目录。如果 RET 在您的肌肉记忆中根深蒂固,您可能需要一个小的自定义命令并重新映射 RET。

If you mostly want to have each dired buffer work with various subdirs that are all under a single hierarchy (e.g. one dired buffer for each of several ongoing projects), you can use the built-in i (dired-maybe-insert-subdir) and k (dired-do-kill-lines on the header of an inserted subdir to remove it from the buffer) commands. They will let you edit multiple directories inside a single dired buffer. You might want a small custom command and to remap RET if it is too ingrained in your muscle memory though.

黑寡妇 2024-08-30 15:14:51

我通过在子目录上点击 a (dired-find-alternate-file) 来减少 dired-buffer 混乱,而不是 RET< /kbd>;回收当前的 Dired 窗口。

I reduce the dired-buffer clutter by hitting a (dired-find-alternate-file) on subdirectories, rather than RET; that recycles the current dired window.

樱桃奶球 2024-08-30 15:14:51

http://www.emacswiki.org/emacs/dired-single.el

<前><代码>;;; dired-single.el --- 重用当前的 dired 缓冲区来访问另一个目录...

;;;评论:
;;
;;这个包提供了一种重用当前dired buffer来访问的方法
;;另一个目录(而不是为新目录创建新缓冲区)。
;;或者,它允许用户指定所有此类缓冲区都将使用的名称
;;无论它们指向哪个目录...

http://www.emacswiki.org/emacs/dired-single.el

;;; dired-single.el --- Reuse the current dired buffer to visit another directory...

;;; Commentary:
;;
;;  This package provides a way to reuse the current dired buffer to visit
;;  another directory (rather than creating a new buffer for the new directory).
;;  Optionally, it allows the user to specify a name that all such buffers will
;;  have, regardless of the directory they point to...
自控 2024-08-30 15:14:51

Dired+ 允许您选择执行此操作,并且它允许您可以随时打开/关闭它。

另请参阅 http://www.emacswiki.org/emacs/DiredReuseDirectoryBuffer

Dired+ lets you do this optionally, and it lets you toggle it on/off anytime.

See also http://www.emacswiki.org/emacs/DiredReuseDirectoryBuffer.

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