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

Evil's undo granularity is too coarse-grained and different from Vim's #444

Closed
TheBB opened this issue Nov 11, 2014 · 2 comments
Closed

Comments

@TheBB
Copy link
Member

TheBB commented Nov 11, 2014

Originally reported by: Titus von der Malsburg (Bitbucket: tmalsburg, GitHub: tmalsburg)


The default undo behavior in Evil is too coarse-grained because it considers anything taking place between entering insert mode and leaving it as one edit operation. When you enter a whole paragraph of text during one insert and then execute undo, the whole paragraph is removed. In contrast to that, Vim starts a new undo unit whenever you move the cursor in insert mode (by means other than entering text).

Evil has a customization variable that can be used to get a more fine-grained undo history:

(setq evil-want-fine-undo t)

With this setting, Evil starts a new undo unit when the cursor is moved in insert mode, just like Vim does. However, this setting also messes with how the replace operation is handled: if you replace a word using cw, you have to undo twice to restore the original word: once for removing the new word and once for reinserting the original word. This is inconsistent with Vim and doesn't make much sense because replace should be an atomic operation.

This issue may not be a big problem for people who are mainly writing code. However, if you use Evil to write text (emails, articles, ...), this is a real problem and results in degraded usability.


@TheBB
Copy link
Member Author

TheBB commented Nov 13, 2014

Original comment by Frank Fischer (Bitbucket: lyro, GitHub: lyro):


add new possible value fine to evil-want-fine-undo (fix #444)

This value causes Evil to behave as if evil-want-fine-undo is t but
merges the deletion of a change operator with the first subsequent
insertion. This is implemented by removing only the first undo
boundary in evil-refresh-undo-step.

@TheBB
Copy link
Member Author

TheBB commented Jul 31, 2016

Original comment by Titus von der Malsburg (Bitbucket: tmalsburg, GitHub: tmalsburg):


Since the setting 'fine is obsolete now, I think this issue 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

1 participant