fix(core): reset foldlevel on entering a diff window
This commit is contained in:
@@ -66,6 +66,18 @@ vim.api.nvim_create_autocmd({ "BufReadPost" }, {
|
|||||||
command = 'silent! normal! g`"zv',
|
command = 'silent! normal! g`"zv',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("BufWinEnter", {
|
||||||
|
desc = "Reset foldlevel to 0 when entering a diff window."
|
||||||
|
.. " Vim's partial diff-state restoration on buffer re-entry"
|
||||||
|
.. " (e.g. via <C-o>) doesn't re-apply foldlevel=0, so"
|
||||||
|
.. " foldlevelstart leaks through and folds appear open.",
|
||||||
|
callback = function()
|
||||||
|
if vim.wo.diff then
|
||||||
|
vim.wo.foldlevel = 0
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
pattern = { "c" },
|
pattern = { "c" },
|
||||||
callback = function()
|
callback = function()
|
||||||
|
|||||||
Reference in New Issue
Block a user