serhii.net LINKS BLOG!

In the middle of the desert you can say anything you want

18 Feb 2017

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

Categories:
  • IT/Linux
  • IT/Linux/CLI
  • Taxonomy/Adj/Good
  • TODO
  • (show all) All categories:
  • IT
  • IT/Linux
  • IT/Linux/CLI
  • Taxonomy
  • Taxonomy/Adj
  • Taxonomy/Adj/Good
  • TODO

  • Tags:
  • Vim
  • Cli
  • Registers

  • Rating: 6; Complexity: 6
    Title: vi - How do I use vim registers? - Stack Overflow
    Link: https://stackoverflow.com/questions/1497958/how-do-i-use-vim-registers/1504373#1504373

    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