dotfiles/emacs/.emacs.d/init/dired-init.org

44 lines
1 KiB
Org Mode
Raw Normal View History

2016-10-13 00:16:32 +02:00
#+TITLE: Dired
#+BEGIN_SRC emacs-lisp
(require 'dired)
(require 'dired-x)
#+END_SRC
Show human-readable sizes in dired buffers.
#+BEGIN_SRC emacs-lisp
(setq dired-listing-switches "-alh")
#+END_SRC
Show the same info for subdirectories, but don't show the =.= and =..=
directories, since those are most likely already shown in the buffer.
#+BEGIN_SRC emacs-lisp
(setq dired-subdir-switches "-Alh")
#+END_SRC
Add a keybinding to dired buffers to change to wdired.
#+BEGIN_SRC emacs-lisp
(defun oni:dired-add-wdired-keybinding ()
"Add a keybinding for wdired mode."
(define-key dired-mode-map (kbd "E") 'wdired-change-to-wdired-mode))
(add-hook 'dired-mode-hook 'oni:dired-add-wdired-keybinding)
#+END_SRC
Open PDF files in zathura.
#+BEGIN_SRC emacs-lisp
(add-to-list 'dired-guess-shell-alist-user
`(,(rx ".pdf" eos) "zathura"))
#+END_SRC
Open Jpeg, Gif and PNG files in feh.
#+BEGIN_SRC emacs-lisp
(add-to-list 'dired-guess-shell-alist-user
`(,(rx (or ".jpg" ".jpeg" ".png" ".gif") eos) "feh"))
#+END_SRC