【问题标题】:dired mode single window? (emacs)dired模式单窗口? (emacs)
【发布时间】:2011-01-22 16:08:15
【问题描述】:

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

【问题讨论】:

标签: emacs elisp file-management dired


【解决方案1】:

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...

【讨论】:

    【解决方案2】:

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

    另见http://www.emacswiki.org/emacs/DiredReuseDirectoryBuffer

    【讨论】:

      【解决方案3】:

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

      【讨论】:

        【解决方案4】:

        如果您最希望让每个 dired 缓冲区与所有位于单个层次结构下的各种子目录一起工作(例如,几个正在进行的项目中的每一个都有一个 dired 缓冲区),您可以使用内置的 i ( dired-maybe-insert-subdir) 和kdired-do-kill-lines 在插入的子目录的标题上以将其从缓冲区中删除)命令。它们将允许您在单个 dired 缓冲区内编辑多个目录。如果它在您的肌肉记忆中根深蒂固,您可能需要一个小的自定义命令并重新映射 RET

        【讨论】:

          【解决方案5】:

          像这样?

          (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)
          ))
          

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2010-10-28
            • 1970-01-01
            • 1970-01-01
            • 2012-10-16
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多