fix(egdy): do not add panes for not enabled neo-tree sources

This commit is contained in:
Andre Freitas 2024-06-15 12:15:02 +00:00
parent 0422dd278a
commit 49b2e98c3f

View file

@ -66,24 +66,6 @@ return {
size = { height = 0.5 },
},
{ title = "Neotest Summary", ft = "neotest-summary" },
{
title = "Neo-Tree Git",
ft = "neo-tree",
filter = function(buf)
return vim.b[buf].neo_tree_source == "git_status"
end,
pinned = true,
open = "Neotree position=right git_status",
},
{
title = "Neo-Tree Buffers",
ft = "neo-tree",
filter = function(buf)
return vim.b[buf].neo_tree_source == "buffers"
end,
pinned = true,
open = "Neotree position=top buffers",
},
{
title = "Neo-Tree Other",
ft = "neo-tree",
@ -112,6 +94,32 @@ return {
end,
},
}
-- only add neo-tree sources if they are enabled in config
if vim.list_contains(LazyVim.opts("neo-tree").sources, "git_status") then
table.insert(opts.left, 3, {
title = "Neo-Tree Git",
ft = "neo-tree",
filter = function(buf)
return vim.b[buf].neo_tree_source == "git_status"
end,
pinned = true,
open = "Neotree position=right git_status",
})
end
if vim.list_contains(LazyVim.opts("neo-tree").sources, "buffers") then
table.insert(opts.left, 3, {
title = "Neo-Tree Buffers",
ft = "neo-tree",
filter = function(buf)
return vim.b[buf].neo_tree_source == "buffers"
end,
pinned = true,
open = "Neotree position=top buffers",
})
end
for _, pos in ipairs({ "top", "bottom", "left", "right" }) do
opts[pos] = opts[pos] or {}
table.insert(opts[pos], {