auto-save.nvim icon indicating copy to clipboard operation
auto-save.nvim copied to clipboard

Can't redo the changes after file saved

Open belogermanotta opened this issue 2 years ago • 6 comments

Config:

{
    "Pocco81/auto-save.nvim",
    debounce_delay = 1000,
    config = function()
      require("auto-save").setup()
    end,
}

I can press u to undo if I hold it for a while, but I can't press redo (ctrl + r) to get the previous changes

belogermanotta avatar Feb 01 '23 03:02 belogermanotta

Yeah, I came here searching for a solution for undo.I have to press undo (u) about 10 times in a second for it to let me undo one thing

mslauson avatar Apr 12 '23 18:04 mslauson

Please provide your exact config. The one posted by @belogermanotta clearly is not correct (the debounce_delay key should go into the setup function).

primeapple avatar Apr 13 '23 07:04 primeapple

I have the same issue with undo. It seems to be an issue with autosave + auto format on save. For instance, deleting a line with dd triggers autosave which triggers auto-format which triggers autosave. Then u undoes the auto-format, but that also triggers autosave which re-triggers autosave. Something like that anyway.

SpacewaIker avatar May 19 '23 15:05 SpacewaIker

It happens when deleting "world" from "Hello world", the "world" will be removed then saved then the space will be automatically removed then saved again. Is there a way to delay every save of 1s for example ?

lunics avatar Jan 30 '24 21:01 lunics

I have the same issue with undo. It seems to be an issue with autosave + auto format on save. For instance, deleting a line with dd triggers autosave which triggers auto-format which triggers autosave. Then u undoes the auto-format, but that also triggers autosave which re-triggers autosave. Something like that anyway.

That makes sense, did you figure something out or just stopped using the plugin @SpacewaIker?

linkarzu avatar Jun 08 '24 02:06 linkarzu

Ok, I basically switched to okuuva/auto-save.nvim and now my undo/redo issues are gone, I'm using the lazyvim.org distro by the way, which autoformats by default (and I love it)

linkarzu avatar Jun 08 '24 11:06 linkarzu