Dired:仅重用目录缓冲区


9

为了防止每次创建目录进入目录时,我都使用以下命令:

(put 'dired-find-alternate-file 'disabled nil)

我现在的问题是,当我通过按Dired键访问文件RET然后杀死它时,Dired缓冲区也被杀死了。

是否可以仅将Dired缓冲区重新用于目录?

Answers:


5

加载库Dired +dired + .el)。然后使用C-M-R(aka C-M-S-r)切换Dired是否应重用Dired缓冲区。

如果要默认情况下启用此重用,请在init文件中执行此操作:

(diredp-toggle-find-file-reuse-dir 1)

5

如果您习惯a用选定的文件/目录替换当前(污损)缓冲区的事实,那么您就不会受到默认方法的限制。您只需使用当时想要的选项即可。


0

Drew使用Dired +的解决方案(可接受的答案)对我不起作用(它使我的Dired缓冲区混乱了,因此只出现了文件夹/文件名,但通常不是所有其他信息都出现在Dired缓冲区中。与我的一项定制)。

然后,我使用dired-simple.el找到了另一种可行的方式。在下载链接文件并将其放置在您的加载路径中之后,请将其包含在您的init文件中

      (require 'dired-single)

      (defun my-dired-init ()
        "Bunch of stuff to run for dired, either immediately or when it's
         loaded."
        ;; <add other stuff here>
        (define-key dired-mode-map [return] 'dired-single-buffer)
        (define-key dired-mode-map [mouse-1] 'dired-single-buffer-mouse) 
        (define-key dired-mode-map "^"
        (function
         (lambda nil (interactive) (dired-single-buffer "..")))))

      ;; if dired's already loaded, then the keymap will be bound
      (if (boundp 'dired-mode-map)
        ;; we're good to go; just add our bindings
        (my-dired-init)
        ;; it's not loaded yet, so add our bindings to the load-hook
        (add-hook 'dired-load-hook 'my-dired-init))

要解决您提到的问题dired+,请尝试设置以下内容:(customize-set-variable 'diredp-hide-details-initially-flag nil)
nispio
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.