Emacs: Copy to Register
Emacs has “registers” that allows you to store arbitrary text. It is like multiple-clipboards.
Let's say you have 2 pieces of text: A and B. You need to paste A in some places, paste B in other places.
- Select a text, then Alt+x
copy-to-register【Ctrl+x r s】, then type 3. This will store the text in register “3”.
- To paste, Alt+x
insert-register【Ctrl+x r i】, then type 3. This will paste text stored in register “3”.
Register name can be any single digit 0 to 9 or single letter a to z.
One Keypress for Copy/Paste Register 1
Emacs's command for register requires you to chose a register. This is often annoying. Here's a command that just use register 1.
Use Abbrev for Templates
If you have some text you frequently want to paste, such as templates, a more permanent solution is to use emacs abbrevs.
If you have a question, put $5 at patreon and message me.