Added `magit-copy-item-as-kill' command.

* magit.el (magit-copy-item-as-kill): new command to copy sha1 of
commit at point into kill ring.
This commit is contained in:
Marcin Bachry 2008-10-26 18:47:23 +01:00 committed by Marius Vollmer
parent 0bbb824fcd
commit 2c45b73d01
2 changed files with 12 additions and 0 deletions

View file

@ -889,6 +889,7 @@ Many Magit faces inherit from this one by default."
(define-key map (kbd "RET") 'magit-visit-item)
(define-key map (kbd "SPC") 'magit-show-item-or-scroll-up)
(define-key map (kbd "DEL") 'magit-show-item-or-scroll-down)
(define-key map (kbd "C-w") 'magit-copy-item-as-kill)
(define-key map (kbd "b") 'magit-checkout)
(define-key map (kbd "B") 'magit-create-branch)
(define-key map (kbd "m") 'magit-manual-merge)
@ -2336,4 +2337,12 @@ Prefix arg means justify as well."
(magit-section-title section)
(magit-section-info section))))
(defun magit-copy-item-as-kill ()
"Copy sha1 of commit at point into kill ring."
(interactive)
(magit-section-action (item info "copy")
((commit)
(kill-new info)
(message "%s" info))))
(provide 'magit)

View file

@ -244,6 +244,9 @@ the changes made by that commit in reverse. This is obviously useful
to cleanly undo changes that turned out to be wrong. As with @kbd{a},
you need to commit the changes explicitly.
Typing @kbd{C-w} will copy the sha1 of the current commit into the
kill ring.
Typing @kbd{=} will show the differences from the current commit to
the @dfn{marked} commit.