#+TITLE: Dired #+AUTHOR: Christopher James Hayward #+EMAIL: chris@chrishayward.xyz #+PROPERTY: header-args:emacs-lisp :tangle dired.el :comments org #+PROPERTY: header-args :results silent :eval no-export :comments org #+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil #+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil Emacs has a built-in directory editor. * Config Emacs has some really amazing built-in packages, and ~dired~[fn:1] is one of them. It completly coveres everything you would expect from a file manager, but it's not perfect out of the box. ** Current directory I don't want to press =RET= twice to navigate to the current directory. There's a way to get around this problem with ~jump~, included in the ~dired-x~ package, included with Emacs. #+begin_src emacs-lisp (require 'dired-x) #+end_src ** Reusing the same buffer By default, ~dired~[fn:1] will create a new buffer each time you press =RET= over a directory. This leads to unwanted buffers all over the place. Avoid this behaviour with ~dired-single~[fn:2], reusing the same ~dired~ buffer. + Move up a directory with =h= + Open a single buffer with =l= #+begin_src emacs-lisp (use-package dired-single :config (evil-collection-define-key 'normal 'dired-mode-map "h" 'dired-single-up-directory "l" 'dired-single-buffer)) #+end_src * Shortcuts Open a new dired buffer using the ~jump~ command with =SPC d=. #+begin_src emacs-lisp (dotfiles/leader "d" '(dired-jump :which-key "Dired")) #+end_src * Footnotes [fn:1] https://en.wikipedia.org/wiki/Dired [fn:2] https://github.com/crocket/dired-single