summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/plugins/auto-save.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/plugins/auto-save.lua')
-rw-r--r--.config/nvim/lua/plugins/auto-save.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/.config/nvim/lua/plugins/auto-save.lua b/.config/nvim/lua/plugins/auto-save.lua
index 99ff70e..7c5578e 100644
--- a/.config/nvim/lua/plugins/auto-save.lua
+++ b/.config/nvim/lua/plugins/auto-save.lua
@@ -30,8 +30,11 @@ return {
-- Might be unrelated tho
-- Oil error is "cannot save, action already in progress"
- -- Save only if the buffer is not a "special buffer"
- return vim.fn.getbufvar(buf, '&buftype') == ''
+ local buftype = vim.fn.getbufvar(buf, '&buftype')
+ local filetype = vim.bo[buf].filetype
+
+ -- Don't autosave special buffers or Oil buffers
+ return buftype == '' and filetype ~= 'oil'
end,
}
end,