Vim: Registers (/delete registers) ...are great

When you delete something (dd or x amongst others) that goes into the delete "register". You can paste that somewhere else with p. That's like cutting text in others editors.

There's a problem. Say you delete some text you want to paste somewhere else. But, before you paste, you see some other text and you delete that. Now that other text is cut--obliterating your formally "cut" text.

Vim has other registers: locations where it stores text. When you normally delete or copy text (dd or yy etc) that goes into the default register. And when you paste text (p or P), that is pasted from the default register.

You can specify other registers with, for example, "a. In this case a is just a name of a register. "add deletes the line into register a. "ap pastes that line from register a.

So you see some text you want to "cut" somewhere else. You press "add. Now you carry on deleting text with x and dd etc. And finally when you want to paste that formally "cut" text you type "ap .

If you want to add text to an existing register, use the uppercase version of the register. "Add will delete a line into the existing a register.

Type :reg to see all the registers. Registers 0 to 9 are your formally cut text. Register persist between editor quits.

I've removed disqus comments
Instead, press this
to express thanks
So far, 0 people have pressed the octopus