Hi, 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!
+1
A:
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)
))
Kilian Foth
2010-03-02 10:44:57
+1
A:
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.
Chris Johnsen
2010-03-02 11:08:23
Post as comment to OP not a new anwser.
Török Gábor
2010-03-02 12:02:39
+6
A:
I reduce the dired-buffer
clutter by hitting a (dired-find-alternate-file
) on subdirectories, rather than RET; that recycles the current dired window.
offby1
2010-03-02 17:13:17