-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
automatically folds after deleting newlines between folds #94
Comments
Ah, I see. Sorry about that. Is the config here supposed to restore normal functionality to I copied it directly, and |
|
Is there a way to just increment/deincrement mock-indent-level, to simulate standard behavior? |
No, vim.api.nvim_create_autocmd({'WinNew', 'VimEnter'}, {
pattern = '*',
callback = function()
vim.w.my_foldlevel = 20
end
})
vim.keymap.set('n', 'zr', function()
vim.w.my_foldlevel = vim.w.my_foldlevel - 1
require('ufo').closeFoldsWith(vim.w.my_foldlevel)
end)
vim.keymap.set('n', 'zm', function()
vim.w.my_foldlevel = vim.w.my_foldlevel + 1
require('ufo').closeFoldsWith(vim.w.my_foldlevel)
end) |
This seems to be working well. Thanks for the help! vim.api.nvim_create_autocmd({'WinNew', 'VimEnter'}, {
pattern = '*',
callback = function()
vim.w.my_foldlevel = 1
end
})
vim.keymap.set('n', 'zM', function()
vim.w.my_foldlevel = 0
require('ufo').closeFoldsWith(vim.w.my_foldlevel)
end)
vim.keymap.set('n', 'zR', function()
vim.w.my_foldlevel = 5
require('ufo').closeFoldsWith(vim.w.my_foldlevel)
end)
vim.keymap.set('n', 'zr', function()
vim.w.my_foldlevel = vim.w.my_foldlevel + 1
require('ufo').closeFoldsWith(vim.w.my_foldlevel)
end)
vim.keymap.set('n', 'zm', function()
vim.w.my_foldlevel = math.max(vim.w.my_foldlevel - 1, 0)
require('ufo').closeFoldsWith(vim.w.my_foldlevel)
end)
|
Neovim version (nvim -v | head -n1)
NVIM v0.9.0-dev
Operating system/version
linux mint 21
How to reproduce the issue
create text file with multiple levels of folds:
fold to hide
sub
, but show row (set foldlevel=1
, I think)insert or delete a blank newline between the two
row
folds. Both inserting and deleting cause it.editor will now automatically (and undesirably) fold all the way, and hide
row
sExpected behavior
fold level should not change because of modification of text
Actual behavior
The text you're editing gets folded because you edited the text. Especially troublesome if it folds, then you end up deleting N folded lines instead of the single unfolded line you meant to.
The text was updated successfully, but these errors were encountered: