are fold status get saved?
Neovim version (nvim -v | head -n1)
0.9
Operating system/version
macOS
How to reproduce the issue
vim.o.foldcolumn = "1" -- '0' is not bad
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
vim.o.foldlevelstart = -1
vim.o.foldenable = true
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
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
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]]
mkview and loadview are fired by events frequently, which read and write the file IO.
Should add this feature in ufo.