Skip to content

Commit

Permalink
fix(edgy): only enable edgy neo-tree when needed. Fixes LazyVim#3697. C…
Browse files Browse the repository at this point in the history
…loses LazyVim#3703
  • Loading branch information
folke committed Jun 17, 2024
1 parent d9caee6 commit bdca1e9
Showing 1 changed file with 35 additions and 33 deletions.
68 changes: 35 additions & 33 deletions lua/lazyvim/plugins/extras/ui/edgy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,26 +53,7 @@ return {
{ title = "Neotest Output", ft = "neotest-output-panel", size = { height = 15 } },
},
left = {
{
title = "Neo-Tree",
ft = "neo-tree",
filter = function(buf)
return vim.b[buf].neo_tree_source == "filesystem"
end,
pinned = true,
open = function()
require("neo-tree.command").execute({ dir = LazyVim.root() })
end,
size = { height = 0.5 },
},
{ title = "Neotest Summary", ft = "neotest-summary" },
{
title = "Neo-Tree Other",
ft = "neo-tree",
filter = function(buf)
return vim.b[buf].neo_tree_source ~= nil
end,
},
-- "neo-tree",
},
keys = {
Expand All @@ -95,22 +76,43 @@ return {
},
}

-- only add neo-tree sources if they are enabled in config
local neotree_opts = LazyVim.opts("neo-tree.nvim")
local neotree_sources = { buffers = "top", git_status = "right" }
if LazyVim.has("neo-tree.nvim") then
table.insert(opts.left, 1, {
title = "Neo-Tree",
ft = "neo-tree",
filter = function(buf)
return vim.b[buf].neo_tree_source == "filesystem"
end,
pinned = true,
open = function()
require("neo-tree.command").execute({ dir = LazyVim.root() })
end,
size = { height = 0.5 },
})
-- only add neo-tree sources if they are enabled in config
local neotree_opts = LazyVim.opts("neo-tree.nvim")
local neotree_sources = { buffers = "top", git_status = "right" }

for source, pos in pairs(neotree_sources) do
if vim.list_contains(neotree_opts.sources, source) then
table.insert(opts.left, 3, {
title = "Neo-Tree " .. source:gsub("_", " "),
ft = "neo-tree",
filter = function(buf)
return vim.b[buf].neo_tree_source == source
end,
pinned = true,
open = "Neotree position=" .. pos .. " " .. source,
})
for source, pos in pairs(neotree_sources) do
if vim.list_contains(neotree_opts.sources or {}, source) then
table.insert(opts.left, {
title = "Neo-Tree " .. source:gsub("_", " "),
ft = "neo-tree",
filter = function(buf)
return vim.b[buf].neo_tree_source == source
end,
pinned = true,
open = "Neotree position=" .. pos .. " " .. source,
})
end
end
table.insert(opts.left, {
title = "Neo-Tree Other",
ft = "neo-tree",
filter = function(buf)
return vim.b[buf].neo_tree_source ~= nil
end,
})
end

for _, pos in ipairs({ "top", "bottom", "left", "right" }) do
Expand Down

0 comments on commit bdca1e9

Please sign in to comment.