Despite the existence of modern graphical file managers, I still find myself dropping into Emacs dired-mode ("the directory editor") for file management surprisingly often.
I haven't really figured out why. Certain operations just seem easier or faster in dired. Maybe it's because I can use Emacs idioms like incremental search (C-s) for moving to files and directories, and dired-advertised-find-file (f) to open things, which makes navigation speedier than scrolling and mousing inside a folder window. Maybe it's because (unlike graphical file managers) you can mark files (m) for an operation without fear of losing that selection on an errant mouse-click or keystroke. Or maybe it's because of little things like tilde (~), which marks all files in the current dired buffer that match the glob *~ for deletion.
Anyway, calling dired on the current directory when you're editing a file is extremely useful. Accordingly I've bound a keystroke to this function:
; F4 for dired buffer of the current directory in the other window (define-key global-map [f4] (lambda () (interactive) (dired-other-window default-directory)))
The above Elisp binds F4 to open dired on the current directory. If you're a Unix user, then some directories have dotfiles (files whose names begin with .) that you'd rather ignore sometimes. Accordingly, I've also got a binding that uses a regexp to filter out all dotfiles from the view:
; F8 to open dired buffer of the current directory without dotfiles ; in other window (define-key global-map [f8] (lambda () (interactive) (dired-other-window (concat default-directory "[^.]*"))))
No comments:
Post a Comment