https://github.com/daviwil/emacs-from-scratch
C-x d
orC-x C-f
-dired
dired-jump
- open Dired buffer, select the current fileprojectile-dired
Emacs / Evil
n
/j
- next linep
/k
- previous linej
/J
- jump to file in bufferRET
- select file or directory^
- go to parent directoryS-RET
/g O
- Open file in “other” windowM-RET
- Show file in other window without focusing (previewing files)g o
(dired-view-file
) - Open file but in a “preview” mode, close withq
dired-listing-switches:
Try-agho --group-directories-first
g
/g r
Refresh the buffer withrevert-buffer
after changing configuration (and after filesystem changes!)(use-package dired :ensure nil :commands (dired dired-jump) :bind (("C-x C-j" . dired-jump)) :config (evil-collection-define-key 'normal 'dired-mode-map "h" 'dired-up-directory "l" 'dired-find-file))
m
- Marks a fileu
- Unmarks a fileU
- Unmarks all files in buffer* t
/t
- Inverts marked files in buffer% m
- Mark files in buffer using regular expression*
- Lots of other auto-marking functionsk
/K
- “Kill” marked items (refresh buffer withg
/g r
to get them back)- Many operations can be done on a single file if there are no active marks!
C
- Copy marked files (or if no files are marked, the current file)- Copying single and multiple files
U
- Unmark all files in bufferR
- Rename marked files, renaming multiple is a move!% R
- Rename based on regular expression:^test
,old-\&
D
- Delete marked filed
- Mark file for deletionx
- Execute deletion for marksdelete-by-moving-to-trash
- Move to trash instead of deleting permanently
Z
- Compress or uncompress a file or folder to (.tar.gz
)c
- Compress selection to a specific filedired-compress-files-alist
- Bind compression commands to file extension
T
- Touch (change timestamp)M
- Change file modeO
- Change file ownerG
- Change file groupS
- Create a symbolic link to this fileL
- Load an Emacs Lisp file into Emacs
Closed Dired buffers are just buried! They need to be refreshed if you go back to them.
Use dired-single
to help with this: https://github.com/crocket/dired-single
;; Inside `use-package dired`
(use-package dired-single)
(evil-collection-define-key 'normal 'dired-mode-map
"h" 'dired-single-up-directory
"l" 'dired-single-buffer))
(use-package all-the-icons-dired
:hook (dired-mode . all-the-icons-dired-mode))
!
or&
to launch an external program on a file
(use-package dired-open
:config
;; Doesn't work as expected!
(add-to-list 'dired-open-functions #'dired-open-xdg t)
;; -- OR! --
(setq dired-open-extensions '(("png" . "feh")
("mkv" . "mpv"))))
(use-package dired-hide-dotfiles
:hook (dired-mode . dired-hide-dotfiles-mode)
:config
(evil-collection-define-key 'normal 'dired-mode-map
"H" 'dired-hide-dotfiles-mode))