To copy the character at point usually I do Shift-<right> M-w
. I am wondering what are the alternative ways to do this action using only the Emacs standard keybindings (maybe with minimal keystrokes but this is not very important).
Specially when working with unicode characters, it is easier to copy-paste them rather than insert them directly, this is maybe a reason why a convenient shortcut for copying a character would be helpful.
Perhaps an inconvenience with Shift-<right> M-w
is that the fours keys involving in this action are a little far away.
Of course one can define a personal shortcut for this, but I am looking for a standard shortcut.
(Note: It appears that in vim mode vy
can do this).
Edit: I appears that the short answer to my question is no
.
For this reason I accepted the answer given by Emacs User
.
An alternative solution is the following: We can exploit the fact that the shortcut Meta-w
bounds to nothing if a region is selected. Hence we can use the ordinary Meta-w
to copy the character with the following settings The first function was suggested by lawlist
.
This is the best alternative way I found without introducing an extra shortcut.
(defun my-copy-region-as-kill ()
(interactive) (copy-region-as-kill (point) (1+ (point))))
(defun my-copy-character () (interactive)
(if (region-active-p) (kill-ring-save (region-beginning) (region-end))
(my-copy-region-as-kill)))
(global-set-key (kbd "M-w") 'my-copy-character)
S-<right>
you could use `C-SPC C-f`` to set the mark and move forward one char. Not shorter, but less reach. – glucas Aug 7 '15 at 0:28(defun my-copy-region-as-kill () (interactive) (copy-region-as-kill (point) (1+ (point)))) (global-set-key [f5] 'my-copy-region-as-kill)
– lawlist Aug 7 '15 at 0:47