Fix issue of auto save and auto format conflicting.
When auto save and auto format is turned on together, undo and redo does not work as expected because of a circular relationship. Consider this situation:
- A change is made
- Auto save saves this change
- Auto format formats the changed buffer
- Auto save saves this formatting
When you try to undo, you will undo the formatting after which auto save will save this undoing. This creates a circular relationship between auto save and auto format causing issues.
Fix this issue by not auto saving on an undo.
Nice find! Would you mind sharing that on https://github.com/okuuva/auto-save.nvim ? It's the more maintained fork (disclaimer, I'm one of the maintainers).
Hey ! If you are using conform.nvim for formatting, there is a new format option called undojoin (see this PR. This option allows you to merge the formatting with the previous edition in the undo history, so that you don't have to care about formatting anymore with autosave.