diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/init-projectile.el | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lisp/init-projectile.el b/lisp/init-projectile.el index 4b2cfc0..ec311e6 100644 --- a/lisp/init-projectile.el +++ b/lisp/init-projectile.el @@ -50,6 +50,25 @@ I have set `projectile-switch-project-action' to (define-key projectile-mode-map (kbd "C-c p j") 'km/projectile-switch-project-to-file) +(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)) + (key-chord-define-global ";s" 'projectile-switch-project) (key-chord-define-global ";f" 'projectile-find-file) (key-chord-define-global ";d" 'projectile-find-dir) |