summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/init-dired.el22
1 files changed, 22 insertions, 0 deletions
diff --git a/lisp/init-dired.el b/lisp/init-dired.el
index 341d772..ac4c279 100644
--- a/lisp/init-dired.el
+++ b/lisp/init-dired.el
@@ -26,4 +26,26 @@
(setq dired-guess-shell-alist-user
'(("\\.pdf\\'" "zathura")))
+(defun km/dired-switch-to-buffer ()
+ (interactive)
+ (let ((buffer-name (km/dired-completing-buffer)))
+ (switch-to-buffer buffer-name)))
+
+(defun km/dired-switch-to-buffer-other-window ()
+ (interactive)
+ (let ((buffer-name (km/dired-completing-buffer)))
+ (pop-to-buffer buffer-name)))
+
+(defun km/dired-completing-buffer ()
+ (ido-completing-read "Dired buffer: "
+ (-map 'buffer-name (km/dired-buffer-list))))
+
+(defun km/dired-buffer-list ()
+ (--filter (with-current-buffer it
+ (derived-mode-p 'dired-mode))
+ (buffer-list)))
+
+(define-key ctl-x-4-map "D" 'km/dired-switch-to-buffer-other-window)
+(global-set-key (kbd "C-x D") 'km/dired-switch-to-buffer)
+
(provide 'init-dired)