mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-24 21:41:08 +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
|
if opts.folds.enabled then
|
||||||
LazyVim.lsp.on_supports_method("textDocument/foldingRange", function(client, buffer)
|
LazyVim.lsp.on_supports_method("textDocument/foldingRange", function(client, buffer)
|
||||||
local win = vim.api.nvim_get_current_win()
|
local win = vim.api.nvim_get_current_win()
|
||||||
vim.wo[win][0].foldexpr = "v:lua.vim.lsp.foldexpr()"
|
-- Don't overwrite diff foldmethod as plugins like octo.nvim rely on it
|
||||||
vim.wo[win][0].foldmethod = "expr"
|
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)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -100,8 +100,11 @@ return {
|
||||||
|
|
||||||
-- folds
|
-- folds
|
||||||
if vim.tbl_get(opts, "folds", "enable") ~= false then
|
if vim.tbl_get(opts, "folds", "enable") ~= false then
|
||||||
vim.wo.foldmethod = "expr"
|
-- Don't overwrite diff foldmethod as plugins like octo.nvim rely on it
|
||||||
vim.wo.foldexpr = "v:lua.LazyVim.treesitter.foldexpr()"
|
if vim.wo.foldmethod ~= "diff" then
|
||||||
|
vim.wo.foldmethod = "expr"
|
||||||
|
vim.wo.foldexpr = "v:lua.LazyVim.treesitter.foldexpr()"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue