mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-21 20:11:06 +00:00
fix: preserve diff foldmethod in LSP and treesitter fold configs
Co-authored-by: folke <292349+folke@users.noreply.github.com>
This commit is contained in:
parent
2d55258979
commit
7b76e24923
2 changed files with 10 additions and 4 deletions
|
|
@ -147,8 +147,11 @@ return {
|
|||
if opts.folds.enabled then
|
||||
LazyVim.lsp.on_supports_method("textDocument/foldingRange", function(client, buffer)
|
||||
local win = vim.api.nvim_get_current_win()
|
||||
-- Don't overwrite diff foldmethod as plugins like octo.nvim rely on it
|
||||
if vim.wo[win][0].foldmethod ~= "diff" then
|
||||
vim.wo[win][0].foldexpr = "v:lua.vim.lsp.foldexpr()"
|
||||
vim.wo[win][0].foldmethod = "expr"
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -100,9 +100,12 @@ return {
|
|||
|
||||
-- folds
|
||||
if vim.tbl_get(opts, "folds", "enable") ~= false then
|
||||
-- Don't overwrite diff foldmethod as plugins like octo.nvim rely on it
|
||||
if vim.wo.foldmethod ~= "diff" then
|
||||
vim.wo.foldmethod = "expr"
|
||||
vim.wo.foldexpr = "v:lua.LazyVim.treesitter.foldexpr()"
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue