Vi - How do I use vim registers? - Stack Overflow

From Fiamma
Jump to navigationJump to search

https://stackoverflow.com/questions/1497958/how-do-i-use-vim-registers/1504373#1504373
vi - How do I use vim registers? - Stack Overflow

Complexity: 6 Rating: 6


I was pleased when I discovered the 0 register. If you yank text without assigning it to a particular register, then it will be assigned to the 0 register, as well as being saved in the default " register. The difference between the 0 and " registers is that 0 is only populated with yanked text, whereas the default register is also populated with text deleted using d/D/x/X/c/C/s/S commands.
Paste the yanked text with "0p
Or you can append to a register by using a capital letter
"Kyy
Note that p or P pastes from the default register. The longhand equivalent would be ""p (or ""P) and "0 holds the last yank, "1holds the last delete or change.
Additionally, registers and macros work really well together. @n would be executing the exact sequence of characters in the registers!
Mapping to delete single characters without updating the register. _ is the /dev/null of registers. Gotten from	https://stackoverflow.com/questions/1497958/how-do-i-use-vim-registers/1504373#1504373
noremap x "_x