diff options
-rw-r--r-- | lisp/init-ace.el | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lisp/init-ace.el b/lisp/init-ace.el index c33a8b2..074df45 100644 --- a/lisp/init-ace.el +++ b/lisp/init-ace.el @@ -11,6 +11,29 @@ (after 'org (define-key org-mode-map (kbd "C-c m o") 'ace-link-org)) +(defun km/ace-link-dired () + "Ace jump to files in dired buffers." + (interactive) + (ali-generic + (km/ali--dired-collect-references) + (org-open-file (dired-get-filename)))) + +(defun km/ali--dired-collect-references () + (let ((end (window-end)) + points) + (save-excursion + (goto-char (window-start)) + (while (< (point) end) + (-when-let (pos (dired-next-line 1)) + (push pos points))) + (nreverse points)))) + +(after 'dired + ;; This overrides the binding for `dired-find-file-other-window', which + ;; is rebound to 'r'. + (define-key dired-mode-map "o" 'km/ace-link-dired) + (define-key dired-mode-map "r" 'dired-find-file-other-window)) + (define-key window-map "a" 'ace-window) (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l) aw-scope 'global) |