zed icon indicating copy to clipboard operation
zed copied to clipboard

Vim mode repeat last command does not work with `ciw` and similars

Open martinschaer opened this issue 1 year ago • 5 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

With the cursor in the middle of a word (e.g. h|ello), press ciw for "change inside word", type a new word and hit Esc to replace the whole word. Press w to jump to any other word, and press . to repeat the operation of replacing the word.

Expected result: the word where the cursor is should be replaced by the new word.

Current result: the cursor moves left one character, and does not replace the word.

A simpler case works, without the i, as incw and ce. Here's a related previous issue.

The issue happens also with a si in da(

Environment

Zed: v0.120.6 (Zed) OS: macOS 14.3.0 Memory: 64 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

No response

martinschaer avatar Feb 06 '24 16:02 martinschaer

Thanks for reporting! I'd noticed . being broken sometimes but hadn't yet untangled the cause.

If you'd like to pair with me on fixing this, feel free to book time: https://calendly.com/conradirwin/pairing

ConradIrwin avatar Feb 07 '24 02:02 ConradIrwin

Also would add indentation shifts to the list (<< then . to repeat).

taylorthurlow avatar Feb 17 '24 18:02 taylorthurlow

Indentation (<< and >>) is a common use case for me that is broken when using .

jgadbois avatar Feb 21 '24 20:02 jgadbois

From what I have seen it seems to be broken with any action that is more than one letter (maybe called compound actions in vim?). For example A<backspace> will do the proper thing which is go to the end of the line and delete the last character.

If you use . to do this on another line there is some weird stuff that happens, things get deleted but it is much more than the last character.

jordanjones98 avatar Feb 27 '24 17:02 jordanjones98

For the multi-key case this turned out to be only broken if you had (at some point) opened a second zed window.

For << that was because we just forwarded it to the editor, I've put in a shim so that repeat works (though today I learned that you can do >ap in real vim to indent a paragraph; so if anyone is feeling up for a fun vim thing it would be to implement > and < as operators that take counts and motions; instead of just hard-coding >> and << :D).

ConradIrwin avatar Feb 28 '24 03:02 ConradIrwin

This is now included in v0.125.0-pre.

JosephTLyons avatar Mar 01 '24 18:03 JosephTLyons