zed icon indicating copy to clipboard operation
zed copied to clipboard

In vim mode I cannot indent text to the right

Open keshav-c opened this issue 1 year ago • 6 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

In neovim I tested that I can indent text to the right by pressing > followed by motion. So entering >G should indent all the lines from the current line to the right. But in Zed, all that happens is the motion is registered. So >G takes you to the end of the file without any indentation.

https://github.com/zed-industries/zed/assets/6380138/a3361525-88a9-4b0e-80c1-ef2e79d9976f

Environment

Zed: v0.127.3 (Zed) OS: macOS 14.4.0 Memory: 24 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.

No response

keshav-c avatar Mar 22 '24 13:03 keshav-c

Similarly, indentation with other motion keys simply don't work. For example I would expect 5> to ident the line(s) 5 times in visual mode.

This makes it really tedious to indent multiple lines, multiple times, without resorting to the ⌘] key bind.

(not sure if this should be a separate issue or not, but it seems closely related)

beauhankins avatar Mar 28 '24 02:03 beauhankins

Currently >> is hard-coded to "indent current line". we should make > in normal mode push an indent operator onto the stack and handle this more like vim's other operators.

I'd be happy to pair with anyone on this https://calendly.com/conradirwin/pairing

ConradIrwin avatar Apr 06 '24 02:04 ConradIrwin

If it's ok with you Conrad, I would like to join on Saturday April 13, just to see how you solve this. I am pretty new to both Rust and vim though.

keshav-c avatar Apr 07 '24 08:04 keshav-c

I just wanted to create a new issue but I think this is probably the same underlying root cause?

If you make a multi-line indentation in visual mode and the try to repeat it using ., instead of re-indenting the same block, the block from your new cursor position will get indented.

Happy to provide videos, etc. if needed.

passy avatar May 08 '24 09:05 passy

Yup, that's the same bug. . records the previous visual selection - so if > worked as an operator it would work.

ConradIrwin avatar May 08 '24 16:05 ConradIrwin

Similarly, indentation with other motion keys simply don't work. For example I would expect 5> to ident the line(s) 5 times in visual mode.

This makes it really tedious to indent multiple lines, multiple times, without resorting to the ⌘] key bind.

(not sure if this should be a separate issue or not, but it seems closely related)

I've run into this as well.

vmchale avatar May 15 '24 17:05 vmchale