diff options
author | Kyle Meyer <kyle@kyleam.com> | 2014-08-30 01:31:37 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2014-08-30 01:31:37 -0400 |
commit | 0a118f184e4e84f603c293e7f637369ccfe4a827 (patch) | |
tree | 7ca058be58adcd6fed64742ca1cc1ca56220dd3f /lisp | |
parent | 633c0d274006dbceec02875b50f99bf3e4dac706 (diff) | |
download | emacs.d-0a118f184e4e84f603c293e7f637369ccfe4a827.tar.gz |
Move dired-copy-project-filename-as-kill
This is more consistent with location of
'km/org-open-dired-marked-files'.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/init-dired.el | 19 | ||||
-rw-r--r-- | lisp/init-projectile.el | 19 |
2 files changed, 19 insertions, 19 deletions
diff --git a/lisp/init-dired.el b/lisp/init-dired.el index ca5bb5c..0e5b2cf 100644 --- a/lisp/init-dired.el +++ b/lisp/init-dired.el @@ -28,6 +28,25 @@ (setq dired-guess-shell-alist-user '(("\\.pdf\\'" "zathura"))) +(defun km/dired-copy-project-filename-as-kill () + "Copy names of marked project files into kill ring. +This is similar to `dired-copy-filename-as-kill', but the leading +path is always relative to `projectile-project-root'." + (interactive) + (let* ((project-dir (projectile-project-root)) + (string + (mapconcat 'identity + (--map (file-relative-name it project-dir) + (dired-get-marked-files t)) + " "))) + (if (eq last-command 'kill-region) + (kill-append string nil) + (kill-new string)) + (message "%s" string))) + +(after 'projectile + (define-key dired-mode-map "W" 'km/dired-copy-project-filename-as-kill)) + (defun km/dired-switch-to-buffer () (interactive) (let ((buffer-name (km/dired-completing-buffer))) diff --git a/lisp/init-projectile.el b/lisp/init-projectile.el index 9b38b9e..83be162 100644 --- a/lisp/init-projectile.el +++ b/lisp/init-projectile.el @@ -43,25 +43,6 @@ Interactive arguments are processed according to (file-relative-name (thing-at-point 'filename) (projectile-project-root))) -(defun km/dired-copy-project-filename-as-kill () - "Copy names of marked project files into kill ring. -This is similar to `dired-copy-filename-as-kill', but the leading -path is always relative to `projectile-project-root'." - (interactive) - (let* ((project-dir (projectile-project-root)) - (string - (mapconcat 'identity - (--map (file-relative-name it project-dir) - (dired-get-marked-files t)) - " "))) - (if (eq last-command 'kill-region) - (kill-append string nil) - (kill-new string)) - (message "%s" string))) - -(after 'dired - (define-key dired-mode-map "W" 'km/dired-copy-project-filename-as-kill)) - ;; Default binding is D. (def-projectile-commander-method ?r "Open project root in dired." |