From 0aefa4729d659ba6d30b0aa208ed5a2af329f711 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Fri, 3 Feb 2023 17:02:41 -0600 Subject: [PATCH] feat(nvim): save folds between sessions --- .../primary/config/lua/core/autocmds.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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