Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x on last char of line should move to left #92

Closed
bjarthur opened this issue Jan 11, 2024 · 3 comments
Closed

x on last char of line should move to left #92

bjarthur opened this issue Jan 11, 2024 · 3 comments
Labels
bug Something isn't working
Milestone

Comments

@bjarthur
Copy link

if the cursor is on "f" in "julia> asdf" and one presses x while in command mode the "f" is replaced with a space. but if rather the cursor is on say the "s" and x is pressed the "s" is deleted and "df" shifts left so that "adf" is left. another x then conveniently deletes the "d". it would be nice to be able to similarly delete multiple characters at the end of the line. as is it stands now, that requires two key strokes instead of one: x followed by h.

@bjarthur
Copy link
Author

i should add that this is how it works on the zsh and bash command lines

@caleb-allen
Copy link
Owner

caleb-allen commented Feb 20, 2024

Interestingly, debugging this issue reveals a broader pattern vim implements. I was somewhat confused because x is described as a synonym to dl, so I couldn't see how special behavior could be implemented for x only.

But what vim does after dl, and after all delete operations is it adjusts the cursor position if it's outside of a line to ensure the next operation is from within the same line. If the delete operation leaves the cursor at the end of the line, it should move it to the left in order to remain within the line.

This is true for dl and also other text objects, e.g. daw.

So the fix here is to ensure that a delete operation is followed by a "corrective" move of the cursor, if necessary.

@caleb-allen
Copy link
Owner

This should be fixed in #97 and will be included in the next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants