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

Broken behavior of x and delete key in evil mode #2787

Closed
kepi opened this issue Aug 27, 2015 · 11 comments
Closed

Broken behavior of x and delete key in evil mode #2787

kepi opened this issue Aug 27, 2015 · 11 comments

Comments

@kepi
Copy link
Contributor

kepi commented Aug 27, 2015

I just switched yesterday to develop spacemacs and found out that x key is working wrong (= not like in Vim) and same is for delete key.

After some digging I think this change was introduced by commit 84ad24f which originates from pull request #2649

I believe this is bug and not intended behavior.

@kepi
Copy link
Contributor Author

kepi commented Aug 27, 2015

Looks like my digging was wrong one :) Reverting that commit doesn't fix issue.

@syl20bnr
Copy link
Owner

What behavior do you get ?

It seems to behave correctly here, x deletes the current char, X the previous char.

Since delete does not work as well in your configuration then there must be something that modifies the functions called by evil and delete.

SPC h d k or C-h k then enter x or delete, gives me:

  • x in normal state is bound to evil-delete-char with no advice
  • delete is insert state is bound to delete-char again with no advice

@cpaulik
Copy link
Contributor

cpaulik commented Aug 27, 2015

I'm not sure if this is what @kepi meant but I just noticed a difference between master and develop which is strange.

Press $ in develop and the cursor will move beyond the last character in the line and x will not delete anything.
Doing the same on master puts the cursor on the last character and x will delete this character.

@syl20bnr
Copy link
Owner

@cpaulik see #2525

@cpaulik
Copy link
Contributor

cpaulik commented Aug 27, 2015

@syl20bnr Thanks, I did not see this discussion

@kepi
Copy link
Contributor Author

kepi commented Aug 27, 2015

In vim and also in emacs with evil mode (and I belive in production spacemacs too) if I press x it deletes first current character, than characters after the cursor and than start deleting characters before. Better than to explain, this gif shows correct behavior:

delete in evil

@cpaulik
Copy link
Contributor

cpaulik commented Aug 27, 2015

So this is related to the evil-move-beyond-eol setting since it does not delete backwards from the last character if this is set.

(setq evil-move-beyond-eol nil) should solve this issue until a decision in #2525 is reached.

@kepi
Copy link
Contributor Author

kepi commented Aug 27, 2015

Thanks @cpaulik ! With reverting variable back to nil it works as it should.

As long as it would be documented in changelog or upgrade notes, it is probably ok even if I personally dislike it.

@syl20bnr if this is what you intended than you can probably close this issue. It will just be really good to put some big notice somewhere :)

@syl20bnr
Copy link
Owner

This is something to fix when beyond-eol is set to t. Spacemacs is not only Vim it is also Emacs and being able to move behind the last character of a line is very important in Emacs.
I'll try to get $ and x fixed beyond eol.

@syl20bnr
Copy link
Owner

duplicate of #2525

@StreakyCobra
Copy link
Contributor

evil-mode-beyond-eol has been set back to nil in 41459be. This solve this issue, and is coherent with vim behaviour. If evil-move-beyond-eol is set, then it's normal that it's not behaving like in vim anymore.

evil-move-beyond-eol, x (evil-delete-char) and $ (evil-end-of-line) are all native evil function, so if someone don't like this behaviour it should probably be reported upstream.

I'm closing this issue then, but feel free to open a new one in case of troubles with this. I'm also open to discussion if someone think it's not solved and should be reopened ☺️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants