diff options
-rw-r--r-- | lisp/init-git.el | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/init-git.el b/lisp/init-git.el index 9d2967b..3c8ce18 100644 --- a/lisp/init-git.el +++ b/lisp/init-git.el @@ -330,6 +330,7 @@ argument." (defvar km/magit-copy-hook '(km/magit-copy-commit-citation km/magit-copy-commit-message + km/magit-copy-region-commits km/magit-copy-region-hunk km/magit-copy-hunk) "Functions tried by `km/magit-copy-as-kill'. @@ -359,6 +360,13 @@ Format the reference as '<hash>, (\"<subject>\", <date>)'." (+ 4 (point)) (point-at-eol))))) (kill-new (message "%s (\"%s\", %s)" hash subject date))))) +(defun km/magit-copy-region-commits (&optional arg) + (--when-let (magit-region-values 'commit) + (deactivate-mark) + (kill-new + (mapconcat #'identity it + (if arg (read-string "Separator: ") ", "))))) + (defun km/magit-copy-commit-message (&optional arg) (magit-section-when message (kill-new (replace-regexp-in-string |