diff options
author | Kyle Meyer <kyle@kyleam.com> | 2014-06-16 22:31:53 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2014-06-16 22:31:53 -0400 |
commit | 46653bca4d1b1f22f0e8b845066e93db01196ca2 (patch) | |
tree | 3d805ddaefa776452fe1f6de2bc14276af798c84 /lisp | |
parent | bd9b9f8f8694d9bc964019c61f23ca442cafb1af (diff) | |
download | emacs.d-46653bca4d1b1f22f0e8b845066e93db01196ca2.tar.gz |
Add ace-link functions for dired
Diffstat (limited to 'lisp')
-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) |