0

How to I access previous yanks in IdeaVim (I am using PyCharm but probably IdeaVim is the same for every JetBrains product, like IntelliJ IDEA)?

For instance, if I copy one line and then I delete something, I am not able to paste the previous line that was yanked. I am sure that there is a way to circumvent this.

Nisba
  • 3,210
  • 2
  • 27
  • 46
  • You need to learn [registers](http://vimdoc.sourceforge.net/htmldoc/change.html#registers). – phd Mar 24 '20 at 18:08

1 Answers1

2

Vim yanks the deleted text into the default register. To avoid this you should delete text into the blackhole register using. "_d. You can create additional mappings for convenience like nmap d "_d.

More about registers: https://www.brianstorti.com/vim-registers/

Additional option - use ReplaceWithRegister plugin of IdeaVim: https://github.com/JetBrains/ideavim#emulated-vim-plugins.
At the moment it's available in the EAP version and it will be released soon.

Feedforward
  • 4,521
  • 4
  • 22
  • 34
  • 1
    @Nisba the linked post here also details how the numbered registers work in vim... This will give you previously entered values to registers. So if you yank something and then delete something else. The previously yanked value will be in the 0 register. So `"0p`, vim will store last 10 yanks this way. – 110100100 Mar 24 '20 at 18:59
  • Ah! Why would you deprive yourself of deleting into registers? The most recent yanks and deletes are saved anyway – D. Ben Knoble Mar 25 '20 at 13:09