Closed luxus closed 1 year ago
okay i learned that mkview and loadview needs to be used. https://github.com/neovim/neovim/blob/bfe6b49447744cea1cd941660b2a3a501a0701cb/runtime/doc/fold.txt#L42-L43 is this the best way?
-- remember folds
vim.cmd [[
augroup remember_folds
autocmd!
autocmd BufWinLeave *.* mkview
autocmd BufWinEnter *.* silent! loadview
augroup END
]]
No bad, some save session plugins also solve this issue.
In some cases, the snippet above would change the cwd when you enter a buffer, and the following command can solve this problem:
vim.cmd [[set viewoptions-=curdir]]
Neovim version (nvim -v | head -n1)
0.9
Operating system/version
macOS
How to reproduce the issue
when i open a file, fold some lines, closing the file and reopen it (or a :e) i thought the folds stays closed.
Expected behavior
after saving a file and reloading still have the same fold and unfold state
Actual behavior
everything is unfolded again