Emacs: Cut, Copy & Paste

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 typing kill-ring.

You can paste a previous copy content by calling yank-pop M-y one or more time to insert from earlier history:

  1. First, do a paste C-y;
  2. M-y to swap the paste content from previous entry;
  3. 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 type 1. 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.

About Francesco Serafin

I am a PhD student at the Department of Civil, Environmental and Mechanical Engineering at the University of Trento. My two greatest loves: Computer Science and Water (take three with my Lenovo!:D). As a result, the aim of my life is to make both passions coexist. My gpg public key available at https://pgp.mit.edu

Leave a Reply

Your email address will not be published.

*