How do I stop emacs dired mode from opening so many buffers?

后端 未结 6 1714
独厮守ぢ
独厮守ぢ 2020-12-13 05:59

When I use dired mode to browse around and find a file I want to open in Emacs, dired opens a new buffer for each directory I visit when looking for the file ea

相关标签:
6条回答
  • 2020-12-13 06:36

    Use a (dired-find-alternate-file) instead of Enter

    Also, see this page:

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

    0 讨论(0)
  • 2020-12-13 06:45

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

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

    0 讨论(0)
  • 2020-12-13 06:46

    dired-x allows this - do M-x customize-group dired-x and set 'Dired Find Subdir' to on

    0 讨论(0)
  • 2020-12-13 06:47

    From Xah Lee, at http://ergoemacs.org/emacs/emacs_dired_tips.html

    ;; Make dired open in the same window when using RET or ^
    (put 'dired-find-alternate-file 'disabled nil) ; disables warning
    (define-key dired-mode-map (kbd "RET") 'dired-find-alternate-file) ; was dired-advertised-find-file
    (define-key dired-mode-map (kbd "^") (lambda () (interactive) (find-alternate-file "..")))  ; was dired-up-directory
    
    0 讨论(0)
  • 2020-12-13 06:48

    When browsing in dired instead of hitting enter to see a directory use i then it adds that directory to the current buffer.

    0 讨论(0)
  • 2020-12-13 06:48

    I've never managed to get toggle-dired-find-file-reuse-dir to work reliably - I still end up with a variety of dired buffers open, and I'm never quite sure how.

    Recently I discovered dired-single (http://www.emacswiki.org/cgi-bin/wiki/dired-single.el) which seems to work better for me. If you want it guarantees a single dired buffer, and also has a nice command dired-single-magic-buffer which will take you to the open dired buffer if you have one, and opens one if you don't.

    There are some other alternatives if it isn't the multiple dired buffers per se that annoy, so much as the way they pollute your buffer lists. For example, elscreen.el has a dired plugin that keeps the dired buffers in their own tab, and the excellent ibuffer mode allows you to group dired buffers together when you list buffers.

    Hope that helps!

    Simon

    0 讨论(0)
提交回复
热议问题