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

An error is caused when I try to change trigger_events to bufLeave

Open piliplaker opened this issue 2 years ago • 5 comments

image This is my configuration, It cause an error when I temporarily hide nvimtree menu, or when I try to close the welcome page provided by alpha-nvim.

the default autosave trigger event is a little too frequently and annoying when I am coding . But usually I do need to save my work from time to time , and in a way not that noticeable. So I overwrite the default like above.

The error does not cause any thing bad like data loss, It just annoying, in another way.

Am I do this wrong? Or is there any way to improve this?

Thank you for you time.

piliplaker avatar Aug 13 '22 15:08 piliplaker

The plugin needs to check the buf is valid and writeable here https://github.com/Pocco81/auto-save.nvim/blob/main/lua/auto-save/init.lua#L95. Alternatively it could just run the condition before attempting to debounce, where the user could run such checks themselves.

nullishamy avatar Aug 13 '22 16:08 nullishamy

Same, this problem appears when i switch to another buffer with telescope buffer picker too fast. config

RamilGN avatar Aug 13 '22 17:08 RamilGN

This issue seems like #46 . And I have fixed it. Maybe you could try my fork

XXiaoA avatar Aug 15 '22 12:08 XXiaoA

This issue seems like #46 . And I have fixed it. Maybe you could try my fork

Seems like an over-complicated fix, nvim_buf_is_valid does this?

nullishamy avatar Aug 15 '22 14:08 nullishamy

This issue seems like #46 . And I have fixed it. Maybe you could try my fork

Seems like an over-complicated fix, nvim_buf_is_valid does this?

Thanks, it does! I didn't find out this api before

XXiaoA avatar Aug 15 '22 15:08 XXiaoA