Skip to content

Commit

Permalink
fix(auto-save-nvim): not restoring buffer settings (#1265)
Browse files Browse the repository at this point in the history
  • Loading branch information
ALameLlama authored Nov 11, 2024
1 parent 4f1af4b commit 97ef955
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lua/astrocommunity/editing-support/auto-save-nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 97ef955

Please sign in to comment.