From 6971ddca43496303e87e5a384fc26ce7d3c281ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20M=C3=BCller?= Date: Mon, 8 Apr 2024 14:03:27 +0200 Subject: [PATCH] fix: GH-49 Abort save if buffer is invalid or unloaded (#52) --- lua/auto-save/init.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/auto-save/init.lua b/lua/auto-save/init.lua index ab87749..a995bc1 100644 --- a/lua/auto-save/init.lua +++ b/lua/auto-save/init.lua @@ -73,6 +73,10 @@ local function should_be_saved(buf) end local function save(buf) + if not api.nvim_buf_is_loaded(buf) then + return + end + if not api.nvim_buf_get_option(buf, "modified") then logger.log(buf, "Abort saving buffer")