_________________________________________
HOW I USE DIRED AS MY MAIN FILE MANAGER
_________________________________________
Make the default view more usable
=================================
Don't show hidden files by default and group directories first.
,----
| (setq dired-listing-switches "-Bhl --group-directories-first")
`----
You can change the switches on the fly by pressing "C-u s".
Open files with an external program
===================================
Elisp-function to open a file with the appropriate program
(linux)[1].
,----
| (defun open-in-external-app ()
| "Open file on point or marked files with xdg-open"
| (interactive)
| (let* (
| ($file-list (dired-get-marked-files))
| ($do-it-p (if (<= (length $file-list) 5)
| t
| (y-or-n-p "Open more than 5 files? "))))
| (when $do-it-p
| (mapc
| (lambda (file-path)
| (let ((process-connection-type nil))
| (start-process "" nil "xdg-open" file-path))) $file-list))))
`----
Call the function by pressing "e" but only in dired-mode. Also
truncate lines longer than the window width.
,----
| (add-hook 'dired-mode-hook
| (lambda ()
| (define-key dired-mode-map (kbd "e") #'open-in-external-app)
| (toggle-truncate-lines 1)))
`----
Shortcut to the home directory
==============================
Just a keybinding to quickly open the home directory.
,----
| (defun go-home ()
| "open dired buffer at home directory"
| (interactive)
| (dired "~/")
| (revert-buffer))
| (global-set-key (kbd "C-#") 'go-home)
`----
Note that "C-#" is the default keybinding for
"org-table-rotate-recalc-marks" so it won't work in org-mode. I
chose this binding because it's near the ENTER key over which my
right hand likes to hover.
Footnotes
_________
[1]
<
http://ergoemacs.org/emacs/emacs_dired_open_file_in_ext_apps.html>