kevinhwang91 / nvim-ufo

Not UFO in the sky, but an ultra fold in Neovim.
BSD 3-Clause "New" or "Revised" License
2.31k stars 47 forks source link

zm and zr not working? #49

Closed ziontee113 closed 2 years ago

ziontee113 commented 2 years ago

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)
kevinhwang91 commented 2 years ago

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.

ziontee113 commented 2 years ago

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.

ziontee113 commented 2 years ago

Actually setting foldlevel to 1 is stupid. I changed it back to 99 and use vim.o.foldlevelstart = 0. Works fine for now :)

kevinhwang91 commented 2 years ago

With a small foldlevel, users should better call require('ufo').disableFold(bufnr) and require('ufo').enableFold(bufnr) by themselves.

ziontee113 commented 2 years ago

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.