zed icon indicating copy to clipboard operation
zed copied to clipboard

vim: support named registers

Open 5tefan opened this issue 1 year ago • 4 comments

Description

Edit: Zed vim does not support named registers. Named registers currently read and write from the primary clipboard -- the same one as ⌘C/⌘V or y/p.

A previous issue about vim registers was incorrectly closed: https://github.com/zed-industries/zed/issues/1507


(Originalish text): In vim, pasting from the default register copies the overwritten value to the default register.

  • Text "bat cat data"
  • Normal mode cursor over bat: viwywviwp replace cat w/ bat. Now register is "cat" (eg wviwp replaces "data" with "cat").

Named registers should not do this. They should keep the value.

  • Text "bat cat data"
  • Normal mode over bat: viw"aywviw"ap replace cat w/ bat. Now register "a" should remain "bat" (eg wviw"ap should replace "data" with "bat").

Zed vim appears to overwrite the register on paste.

5tefan avatar May 07 '24 19:05 5tefan

I don't believe Zed has any concept of vim registers at all. I have seen mention of them here and there (not sure why that got marked completed actually), but don't know that there is a tracking issue for them. I'd love to see some form of register support as a single copy/paste slot has been limiting.

baldwindavid avatar May 07 '24 21:05 baldwindavid

Not having registers is quite a big problem for me because the "use_system_clipboard" option is all or nothing: either I use the system clipboard or I don't. I very much prefer Vim's way of doing things, where by default I don't use the system clipboard, but if I prefix some action with "+ then I do.

dancojocaru2000 avatar May 08 '24 00:05 dancojocaru2000

Looks like #1507 shouldn't have been closed. Retitling this to make it clearer it's a feature request.

If anyone would like to pair with me on this, feel free to book time: https://calendly.com/conradirwin/pairing.

cc @Zachiah who mentioned he'd like to take a go at this.

ConradIrwin avatar May 08 '24 02:05 ConradIrwin

This is currently my most-missed feature of Zed's vim support. I find myself reflexively trying to use registers, which does not work. In particular, if I've highlighted the region, then type " + a + d, it replaces the highlighted region with "ad, which looks like it works (since lots of text was replaced by very little text, which looks like deletion), but when I then paste I get whatever happens to be in my clipboard, which is confusing.

jagill avatar May 14 '24 11:05 jagill

Please we need the registers feature... help Zed team.

Gantushig77 avatar Jun 07 '24 03:06 Gantushig77

Fixed by #12895. There are some more obscure registers that are not yet supported, but please open separate issues if you need those for your workflow.

ConradIrwin avatar Jun 12 '24 16:06 ConradIrwin

Thank you

Gantushig77 avatar Jun 12 '24 16:06 Gantushig77