1. Emacs Cut, Copy & Paste
Cut, Copy and Paste in Emacs, is a bit different when compared to the standard commands. The parallelism is:
Std name | Std CMD | Emacs CMD | Emacs name |
cut | Ctrl-z | C-w | kill-region |
copy | Ctrl-c | M-w | kill-ring-save |
paste | Ctrl-v | C-y | yank |
However, Emacs has a futher very useful tools: a clipboard (called kill-ring) history of copy/cut content.
You can see your copy history in two ways:
- via GUI-menu
Edit -> Paste from kill Menu
; - via CLI by calling describe-variable
F1-v
and then typingkill-ring
.
You can paste a previous copy content by calling yank-pop M-y
one or more time to insert from earlier history:
- First, do a paste
C-y
; M-y
to swap the paste content from previous entry;- Repeat
M-y
for earlier content.
2. Multiple Clipboards: Emacs register
If you want to have a total control on the memorized content, you need to use the registers of Emacs. When a piece of text has been saved in a register, you can paste it all the times you want, by calling the proper register.
How to do it:
- Select a text, then call copy-to-register
C-x r s
, then type1
. This will store the text in register ‘1’ (register can be any digit or letter). - To paste, call insert-register
C-x r i
, then type the register name.