Skip to content

Commit

Permalink
fix: GH-49 Abort save if buffer is invalid or unloaded (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
primeapple authored Apr 8, 2024
1 parent 42fce87 commit 6971ddc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lua/auto-save/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 6971ddc

Please sign in to comment.