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

Different `trigger_events` for different `FileType`

Open Andrew15-5 opened this issue 2 years ago • 1 comments

I want to have this for all file types:

auto_save.setup {
  execution_message,
  trigger_events = { "InsertLeave", "TextChanged" },
}

But this for typst:

auto_save.setup {
  execution_message,
  trigger_events = { "InsertLeave", "TextChanged", "TextChangedI" },
}

I can't get buffer's FileType on Neovim initialization, I can't re-setup the config. Can I check which event was triggered in the condition function? This way, I can cancel TextChangedI event for every non-typst buffer. But I would prefer per-FileType trigger_events.

Either way, can I somehow solve the problem now, or is this a feature request?

P.S. I still use init.vim and have almost 0 knowledge of Neovim's Lua API.

Andrew15-5 avatar Sep 03 '23 21:09 Andrew15-5

Have a look at the more maintained fork https://github.com/okuuva/auto-save.nvim and crosspost the problem there.

For your problem: This looks interesting. I think we could implement something like that on the fork. Condition certainly looks like the wrong place to do this, tho.

primeapple avatar Sep 04 '23 07:09 primeapple