If you prefer standard keys for copy/paste, then turn on cua-mode. Put this in your init:
;; use standard keys for undo cut copy paste (cua-mode 1)
| name | standard keys | emacs keys | emacs name |
|---|---|---|---|
| undo | 【Ctrl+z】 | 【Ctrl+/】 | undo |
| cut | 【Ctrl+x】 | 【Ctrl+w】 | kill-region |
| copy | 【Ctrl+c】 | 【Alt+w】 | kill-ring-save |
| paste | 【Ctrl+v】 | 【Ctrl+y】 | yank |
Emacs's clipboard (called kill-ring) maintains a history of copy/cut content.
You can see your copy history in the menu 〖Edit ▸ Paste from kill Menu〗, or call describe-variable and type kill-ring.
You can paste previous copy content by calling yank-pop 【Alt+y】 one or more times to insert from earlier history. Try this:
There's a package browse-kill-ring.el that lets you visually navigate the kill-ring history. Install it from MELPA. 〔☛ A Guide on Emacs 24 Package System〕
Once installed, call browse-kill-ring to view copy history, and click or press Enter ↵ on a line to insert that entry. Or, you can add this to your init file:
;; invoke visual nagivation of clipboard history with emacs `yank-pop' (paste previous) key, when the key isn't preceded by paste command (browse-kill-ring-default-keybindings)
Sometimes you need to have a piece of text that you need to paste often. Let's say you have 2 pieces of text: {A, B}. You need to paste A in some places, paste B in other places.
Emacs has “registers” for this. It lets you store text in it.
Example use:
copy-to-register 【Ctrl+x r s】, then type 1. This will store the text in register “1”. (register name can be any digit or letter.)insert-register 【Ctrl+x r i】, then type the register name.(register can also store cursor location, file path, …. (info "(emacs) Registers"))
See: Emacs Lisp: Single Key to Copy/Paste from Register.