diff options
author | Kyle Meyer <kyle@kyleam.com> | 2014-04-23 01:24:53 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2014-04-23 01:28:49 -0400 |
commit | df4851f4fbaf2efa87e992904278f4fed4588c90 (patch) | |
tree | 2d6386f51b9e93df3d8c7d4c0a168ff74e862f46 | |
parent | 622245b635cf7a72377c4f81410d507fb2d0dbb7 (diff) | |
download | emacs.d-df4851f4fbaf2efa87e992904278f4fed4588c90.tar.gz |
Add switch-to-buffer functions for dired
-rw-r--r-- | lisp/init-dired.el | 22 |
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) |