Emacs: Copy/Paste and kill-ring History

By Xah Lee. Date: . Last updated: .

Undo, Cut, Copy, Paste

emacs undo cut copy paste keys
namecua mode keysemacs keyscommand
undoCtrl+zCtrl+/】 or 【Ctrl+_】 or 【Ctrl+x uundo
cutCtrl+xCtrl+wkill-region
copyCtrl+cAlt+wkill-ring-save
pasteCtrl+vCtrl+yyank

In emacs:

Standard Copy/Paste Keys: cua-mode

If you prefer standard keys such as 【Ctrl+c】 for copy, 【Ctrl+x】 for cut 【Ctrl+v】 for paste, then turn on cua-mode. Put this in your init:

;; use standard keys for undo cut copy paste
(cua-mode 1)

Paste from Kill Ring History

Emacs's clipboard (called kill-ring) maintains a history of copy/cut content.

View kill-ring Content

emacs kill-ring
emacs kill-ring

To view copy/cut history:

Paste from kill-ring History

There are 2 major ways to paste from previously copied content.

① call universal-argumentCtrl+u】, type number n, then call yank【Ctrl+y】. This will paste the nth item in kill-ring. (if n is 1, it is the same as just yank with no argument.)

Or

② Call yank, then call yank-popAlt+y】 one or more times to insert from earlier history.

Try this:

  1. Do a paste 【Ctrl+y】.
  2. Press 【Alt+y】 to swap the paste content from previous entry.
  3. Repeat 【Alt+y】 for earlier content.

(info "(emacs) Kill Ring")

Multiple Clipboards: Emacs Register

Emacs: Copy to Register

Copy/Paste Topic

  1. Emacs: Copy/Paste and kill-ring History
  2. Emacs: Copy/Cut Current Line If No Selection
  3. Emacs: Copy/Cut All or Selection
  4. Emacs: Paste or Paste Previous
  5. Emacs: Copy to Register
  6. Emacs: 1 Key to Copy/Paste from Register
  7. Emacs: Copy Rectangle Region to kill-ring
  8. Emacs: Sync Copy/Paste Clipboards with Linux X11
Like it? Buy Xah Emacs Tutorial. Thanks.

or, buy something from Best Keyboard for Emacs