From b25a9ae296e00c1f881c03306586ce25c39b64e3 Mon Sep 17 00:00:00 2001 From: Nicholas Ciechanowski Date: Sun, 10 Nov 2024 02:21:33 +0000 Subject: [PATCH] fix(auto-save-nvim): not restoring buffer settings --- lua/astrocommunity/editing-support/auto-save-nvim/init.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lua/astrocommunity/editing-support/auto-save-nvim/init.lua b/lua/astrocommunity/editing-support/auto-save-nvim/init.lua index 730b76423..10ea3435a 100644 --- a/lua/astrocommunity/editing-support/auto-save-nvim/init.lua +++ b/lua/astrocommunity/editing-support/auto-save-nvim/init.lua @@ -15,14 +15,17 @@ return { -- Save global autoformat status vim.g.OLD_AUTOFORMAT = vim.g.autoformat vim.g.autoformat = false - vim.g.OLD_AUTOFORMAT_BUFFERS = {} + + local old_autoformat_buffers = {} -- Disable all manually enabled buffers for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do if vim.b[bufnr].autoformat then - table.insert(vim.g.OLD_AUTOFORMAT_BUFFERS, bufnr) + table.insert(old_autoformat_buffers, bufnr) vim.b[bufnr].autoformat = false end end + + vim.g.OLD_AUTOFORMAT_BUFFERS = old_autoformat_buffers end, }, -- Re-enable autoformat after saving