Closed UNIONDONG closed 7 months ago
Are you still using neovim?
It happens to me too but only on the first keypress, afterwards it behaves correctly. (I've remapped zr and zm as in the readme example)
stale
I also get this as well. Looking at the recommended mappings:
vim.keymap.set('n', 'zR', require('ufo').openAllFolds)
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds)
vim.keymap.set('n', 'zr', require('ufo').openFoldsExceptKinds)
vim.keymap.set('n', 'zm', require('ufo').closeFoldsWith) -- closeAllFolds == closeFoldsWith(0)
It seems that the recommended keybindings for zR
/zM
and zr
/zm
just do the same things:
zR
-> openAllFolds()
-> openFoldsExceptKinds()
zR
-> openFoldsExceptKinds()
zM
-> closeAllFolds()
-> closeFoldsWith(0)
zm
-> closeFoldsWith()
-> closeFoldsWith(0)
(when just pressing zm
without a number, vim.v.count = 0
)
This leads to the behavior where zr
== zR
and zm
== zM
so there actually are no "fold more" or "fold less" operations, they are just doing the same behavvior as the "open all folds" and "close all folds".
Could this be reopened until the functions get fixed? zm
and zr
should essentially increment and decrement foldlevel
as you press them rather than always closing/opening all folds.
If you would rather me open a new issue then I can do that as well. Thanks for all your work on this project!
I was having this same issue, though it was just caused by not setting a provider. The config at the top had its provider commented out, maybe that was the issue?
require('ufo').setup({
provider_selector = function(bufnr, filetype, buftype)
return {'treesitter', 'indent'}
end
})
Neovim version (nvim -v | head -n1)
NVIM v0.10.0-dev
Operating system/version
ubuntu 5.10.16.3
How to reproduce the issue
za & zm fold all code ,why?
config :
Expected behavior
Actual behavior
normal work,only code if while and so on ...