cappyzawa/trim.nvim

Preserve undo-redo registers content after executing trim.nvim

Closed this issue · 4 comments

I would like to introduce a feature request where it is possible to preserve undo-redo steps and doesn't populate it with trim.nvim's steps of whitespace removal.

I would like to introduce a feature request where it is possible to preserve undo-redo steps

Why not solve this by using neovim's undo and redo commands instead of the plugin's functionality?

doesn't populate it with trim.nvim's steps of whitespace removal.

If you save without formatting, use :noa w

undo-redo commands from neovim are garbled with whitespace removal steps, i would like to format it but not have it stored in undo-redo steps

I am sorry but I will not implement this issue as I think the neovim command is sufficient.
(No garbled characters occur in my environment.)

I came here looking if someone reported this before. This is something that I struggle with a lot, because I use auto-save (from another plugin).

What often happens, is I get stuck in this loop, where it's impossible to go back in the undo hostory:

  1. I do a typing mistake (which I want to undo later)
  2. I type an extra space
  3. Exit insert mode, and the auto-save triggers
  4. Whitespace is removed as part of auto-save
  5. I try to undo, but this only undoes the whitespace cleanup
  6. Auto-save triggers, removing whitespace again
  7. Repeat step 5-6, and I can keep hitting 'u' forever, but it won't undo step 1

Because of this, I've now started to learn commands such as :earlier 5s, to jump back in the undo history.