Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(auto-save-nvim): not restoring buffer settings #1265

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading