diff options
author | Kyle Meyer <kyle@kyleam.com> | 2015-06-23 22:36:55 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2015-06-23 22:36:55 -0400 |
commit | af897e44bb9ebd710e01760dc3c90a3e64d14d77 (patch) | |
tree | 614d69b041687e33a9882210da76b839cff6e71f /lisp | |
parent | 1fe4776e96405d8719f19893a1f3f2ba3b839c3e (diff) | |
download | emacs.d-af897e44bb9ebd710e01760dc3c90a3e64d14d77.tar.gz |
Add dired-jump-file-at-point command
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/init-files.el | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lisp/init-files.el b/lisp/init-files.el index b1a7778..994687a 100644 --- a/lisp/init-files.el +++ b/lisp/init-files.el @@ -42,6 +42,14 @@ (setq file (concat "/sudo:root@localhost:" file))) (find-file file))) +(defun km/dired-jump-file-at-point () + "Run `dired-jump' on file at point." + (interactive) + (let ((file (thing-at-point 'filename))) + (if (and file (file-exists-p file)) + (dired-jump 'other-window (expand-file-name file)) + (user-error "No file at point")))) + (defun km/write-file () "Run `write-file'. Use the current file name as initial input of prompt." @@ -59,6 +67,7 @@ Use the current file name as initial input of prompt." (define-prefix-command 'km/file-map) (global-set-key (kbd "C-c f") 'km/file-map) +(define-key km/file-map "j" 'km/dired-jump-file-at-point) (define-key km/file-map "R" 'km/find-file-as-root) (define-key km/file-map "n" 'km/rename-current-buffer-file) (define-key km/file-map "l" 'nlines-run-command) |