Feature request: set delay before autosaving
It would be nice to be able to set a delay before autosave is run after receiving trigger event.
Use case: I use tidy because cleaning up trailing whitespaces is a task best left to automation. Using tidy with auto-save.nvim makes pasting stuff from registers at the end of line / file hard because file is automatically saved (and thus cleaned of traling spaces / lines) immediately after exiting insert mode.
Setting debounce_delay doesn't help because if I understood it correctly it only prevents the same buffer getting saved multiple times during the given time frame and it still saves the buffer immediately if it hasn't already been saved during that time frame.
I think I might be able to implement this with an autocommand that emits a custom event after a given delay when it receives a triggering event. If somebody has any better ideas I'm all ears.
This is a problem with tidy, not auto-save. It should allow specifying the event that triggers it, but it's hardcoded:
https://github.com/mcauley-penney/tidy.nvim/blob/9b15a0eb12d6d4f0bb5c197c1f5b72bcc57f09ff/lua/tidy/init.lua#L49
vim.api.nvim_create_autocmd("BufWritePre", {
Ideally, we could get some sort of grouping mechanism for these "auto-whatever" plugins, but as a largely enthusiast group of authors, it's not easy to synchronize.
That is indeed a problem with tidy but I still think it would be nice to have a user specified delay before autosave. If nothing more it would act as a workaround for other auto-plugins with no configuration options.