nvim-ufo
nvim-ufo copied to clipboard
zm and zr not working?
Neovim version (nvim -v | head -n1)
0.7
Operating system/version
Arch Linux
How to reproduce the issue
Pressing zm and zr
Expected behavior
Close / Open all folds by 1 level.
Actual behavior
Nothing happens.
Using ufo zR and zM works fine, but not zm and zr, they just do nothing.
vim.keymap.set("n", "zR", require("ufo").openAllFolds)
vim.keymap.set("n", "zM", require("ufo").closeAllFolds)
It should work as expected when folelevel is small.
foldmethod=manual should better set a large value for foldlevel. I have no idea how to maintain a my_foldlevel to make zm and zr work like small foldlevel.
Oh thanks, I just copied the sample code that sets foldlevel=99. Setting it to 1 solves the problem, I'll experiment with it further.
Actually setting foldlevel to 1 is stupid. I changed it back to 99 and use vim.o.foldlevelstart = 0. Works fine for now :)
With a small foldlevel, users should better call require('ufo').disableFold(bufnr) and require('ufo').enableFold(bufnr) by themselves.
I think having -1 foldlevelstart screws up zm and zr for some reason. If I set it to -1 zm and zr just do absolutely nothing.