[Dired] Restructuring local key bindings
This commit is contained in:
parent
c48a75048b
commit
1b7f3dcf85
22
init.el
22
init.el
|
@ -755,6 +755,12 @@ are assumed to be of the form *.crt."
|
||||||
|
|
||||||
(use-package dired
|
(use-package dired
|
||||||
:defer t
|
:defer t
|
||||||
|
:bind (:map dired-mode-map
|
||||||
|
("e" . ora-ediff-files)
|
||||||
|
("z" . dired-get-size)
|
||||||
|
([remap beginning-of-buffer] . dired-back-to-top)
|
||||||
|
([remap end-of-buffer] . dired-jump-to-bottom)
|
||||||
|
("<f1>" . nil))
|
||||||
:config (progn
|
:config (progn
|
||||||
(setq dired-dwim-target t)
|
(setq dired-dwim-target t)
|
||||||
(put 'dired-find-alternate-file 'disabled nil)
|
(put 'dired-find-alternate-file 'disabled nil)
|
||||||
|
@ -809,11 +815,6 @@ are assumed to be of the form *.crt."
|
||||||
(when on-windows
|
(when on-windows
|
||||||
(setq directory-free-space-program nil))
|
(setq directory-free-space-program nil))
|
||||||
|
|
||||||
;; custom keybindings
|
|
||||||
|
|
||||||
(unbind-key "s" dired-mode-map)
|
|
||||||
(unbind-key "<f1>" dired-mode-map)
|
|
||||||
|
|
||||||
(defun ora-ediff-files ()
|
(defun ora-ediff-files ()
|
||||||
"Compare marked files in dired with ediff."
|
"Compare marked files in dired with ediff."
|
||||||
;; from: https://oremacs.com/2017/03/18/dired-ediff/
|
;; from: https://oremacs.com/2017/03/18/dired-ediff/
|
||||||
|
@ -835,7 +836,6 @@ are assumed to be of the form *.crt."
|
||||||
(setq ediff-after-quit-hook-internal nil)
|
(setq ediff-after-quit-hook-internal nil)
|
||||||
(set-window-configuration wnd))))
|
(set-window-configuration wnd))))
|
||||||
(error "No more than 2 files should be marked"))))
|
(error "No more than 2 files should be marked"))))
|
||||||
(bind-key "e" #'ora-ediff-files dired-mode-map)
|
|
||||||
|
|
||||||
(defun dired-back-to-top ()
|
(defun dired-back-to-top ()
|
||||||
"Jump to first non-trivial line in dired."
|
"Jump to first non-trivial line in dired."
|
||||||
|
@ -843,18 +843,12 @@ are assumed to be of the form *.crt."
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(dired-next-line 1))
|
(dired-next-line 1))
|
||||||
|
|
||||||
(bind-key [remap beginning-of-buffer]
|
|
||||||
#'dired-back-to-top dired-mode-map)
|
|
||||||
|
|
||||||
(defun dired-jump-to-bottom ()
|
(defun dired-jump-to-bottom ()
|
||||||
"Jump to last non-trivial line in dired."
|
"Jump to last non-trivial line in dired."
|
||||||
(interactive)
|
(interactive)
|
||||||
(goto-char (point-max))
|
(goto-char (point-max))
|
||||||
(dired-next-line -1))
|
(dired-next-line -1))
|
||||||
|
|
||||||
(bind-key [remap end-of-buffer]
|
|
||||||
'dired-jump-to-bottom dired-mode-map)
|
|
||||||
|
|
||||||
(defun dired-get-size () ; from emacswiki, via oremacs
|
(defun dired-get-size () ; from emacswiki, via oremacs
|
||||||
"Print size of all files marked in the current dired buffer."
|
"Print size of all files marked in the current dired buffer."
|
||||||
(interactive)
|
(interactive)
|
||||||
|
@ -865,9 +859,7 @@ are assumed to be of the form *.crt."
|
||||||
"size of all marked files: %s"
|
"size of all marked files: %s"
|
||||||
(progn
|
(progn
|
||||||
(re-search-backward "\\(^[0-9.,]+[a-za-z]+\\).*total$")
|
(re-search-backward "\\(^[0-9.,]+[a-za-z]+\\).*total$")
|
||||||
(match-string 1))))))
|
(match-string 1))))))))
|
||||||
|
|
||||||
(bind-key "z" #'dired-get-size dired-mode-map)))
|
|
||||||
|
|
||||||
(use-package find-dired
|
(use-package find-dired
|
||||||
:commands (find-dired)
|
:commands (find-dired)
|
||||||
|
|
Loading…
Reference in New Issue