emacs-evil / evil-magit

Black magic or evil keys for magit
https://github.com/justbur/evil-magit
GNU General Public License v3.0
272 stars 16 forks source link

Support registers for "yank" commands? #58

Open ashiklom opened 5 years ago

ashiklom commented 5 years ago

It would be great to implement a version of the Magit "yank" functions that can be combined with evil registers. For example, I often want to copy the commit hash from Magit and paste it into a GitHub issue, Slack channel, etc. It would be really awesome to be able to do this with the keys "+ys (yank to system clipboard).

I think this would require wrapping the magit-yank-* in evil-define-command with register support, but I don't know evil's internals well enough to do it myself.

In the meantime, in case it's useful for others, I wrote the following helper function for copying the top of my kill ring to the system clipboard:

(setq select-enable-clipboard t)

(defun ans/kill-ring-to-clipboard ()
  "Copy current kill ring to system clipboard"
  (interactive)
  (gui-select-text (current-kill 0)))