diff --git a/dots/.nvim-environments/primary/config/lua/core/autocmds.lua b/dots/.nvim-environments/primary/config/lua/core/autocmds.lua index 4ad4797c..b2b96f79 100644 --- a/dots/.nvim-environments/primary/config/lua/core/autocmds.lua +++ b/dots/.nvim-environments/primary/config/lua/core/autocmds.lua @@ -12,6 +12,20 @@ M.setup = function() vim.api.nvim_create_autocmd("BufWritePre", { command = "%s/\\s\\+$//e", }) + + -- NOTE: Remember folds + vim.api.nvim_create_augroup("SaveFolds", { clear = true }) + vim.api.nvim_create_autocmd("BufWinLeave", { + pattern = "*.*", + command = "mkview", + group = "SaveFolds" + }) + vim.api.nvim_create_autocmd("BufWinEnter", { + pattern = "*.*", + command = "silent! loadview", + group = "SaveFolds" + }) + end return M