return { -- edgy { "folke/edgy.nvim", event = "VeryLazy", keys = { { "ue", function() require("edgy").toggle() end, desc = "Edgy Toggle", }, -- stylua: ignore { "uE", function() require("edgy").select() end, desc = "Edgy Select Window" }, }, opts = function() local opts = { bottom = { { ft = "toggleterm", size = { height = 0.4 }, filter = function(buf, win) return vim.api.nvim_win_get_config(win).relative == "" end, }, { ft = "noice", size = { height = 0.4 }, filter = function(buf, win) return vim.api.nvim_win_get_config(win).relative == "" end, }, { ft = "lazyterm", title = "LazyTerm", size = { height = 0.4 }, filter = function(buf) return not vim.b[buf].lazyterm_cmd end, }, "Trouble", { ft = "qf", title = "QuickFix" }, { ft = "help", size = { height = 20 }, -- don't open help files in edgy that we're editing filter = function(buf) return vim.bo[buf].buftype == "help" end, }, { title = "Spectre", ft = "spectre_panel", size = { height = 0.4 } }, { title = "Neotest Output", ft = "neotest-output-panel", size = { height = 15 } }, }, left = { { title = "Neotest Summary", ft = "neotest-summary" }, -- "neo-tree", }, keys = { -- increase width [""] = function(win) win:resize("width", 2) end, -- decrease width [""] = function(win) win:resize("width", -2) end, -- increase height [""] = function(win) win:resize("height", 2) end, -- decrease height [""] = function(win) win:resize("height", -2) end, }, } if LazyVim.has("neo-tree.nvim") then local pos = { filesystem = "left", buffers = "top", git_status = "right", document_symbols = "bottom", diagnostics = "bottom", } local sources = LazyVim.opts("neo-tree.nvim").sources or {} for i, v in ipairs(sources) do table.insert(opts.left, i, { title = "Neo-Tree " .. v:gsub("_", " "):gsub("^%l", string.upper), ft = "neo-tree", filter = function(buf) return vim.b[buf].neo_tree_source == v end, pinned = true, open = function() vim.cmd(("Neotree show position=%s %s dir=%s"):format(pos[v] or "bottom", v, LazyVim.root())) end, }) end end for _, pos in ipairs({ "top", "bottom", "left", "right" }) do opts[pos] = opts[pos] or {} table.insert(opts[pos], { ft = "trouble", filter = function(_buf, win) return vim.w[win].trouble and vim.w[win].trouble.position == pos and vim.w[win].trouble.type == "split" and vim.w[win].trouble.relative == "editor" and not vim.w[win].trouble_preview end, }) end return opts end, }, -- use edgy's selection window { "nvim-telescope/telescope.nvim", optional = true, opts = { defaults = { get_selection_window = function() require("edgy").goto_main() return 0 end, }, }, }, -- prevent neo-tree from opening files in edgy windows { "nvim-neo-tree/neo-tree.nvim", optional = true, opts = function(_, opts) opts.open_files_do_not_replace_types = opts.open_files_do_not_replace_types or { "terminal", "Trouble", "qf", "Outline", "trouble" } table.insert(opts.open_files_do_not_replace_types, "edgy") end, }, -- Fix bufferline offsets when edgy is loaded { "akinsho/bufferline.nvim", optional = true, opts = function() local Offset = require("bufferline.offset") if not Offset.edgy then local get = Offset.get Offset.get = function() if package.loaded.edgy then local old_offset = get() local layout = require("edgy.config").layout local ret = { left = "", left_size = 0, right = "", right_size = 0 } for _, pos in ipairs({ "left", "right" }) do local sb = layout[pos] local title = " Sidebar" .. string.rep(" ", sb.bounds.width - 8) if sb and #sb.wins > 0 then ret[pos] = old_offset[pos .. "_size"] > 0 and old_offset[pos] or pos == "left" and ("%#Bold#" .. title .. "%*" .. "%#BufferLineOffsetSeparator#│%*") or pos == "right" and ("%#BufferLineOffsetSeparator#│%*" .. "%#Bold#" .. title .. "%*") ret[pos .. "_size"] = old_offset[pos .. "_size"] > 0 and old_offset[pos .. "_size"] or sb.bounds.width end end ret.total_size = ret.left_size + ret.right_size if ret.total_size > 0 then return ret end end return get() end Offset.edgy = true end end, }, }