diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index d37153c7..073e0781 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -38,6 +38,7 @@ return { end, opts = { sources = { "filesystem", "buffers", "git_status", "document_symbols" }, + open_files_do_not_replace_types = { "terminal", "Trouble", "qf", "Outline" }, filesystem = { bind_to_cwd = false, follow_current_file = true, diff --git a/lua/lazyvim/plugins/extras/ui/edgy.lua b/lua/lazyvim/plugins/extras/ui/edgy.lua new file mode 100644 index 00000000..69452ae5 --- /dev/null +++ b/lua/lazyvim/plugins/extras/ui/edgy.lua @@ -0,0 +1,101 @@ +return { + -- edgy + { + "folke/edgy.nvim", + event = "VeryLazy", + opts = { + bottom = { + { ft = "toggleterm", size = { height = 0.4 } }, + { + 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 } }, + { ft = "spectre_panel", size = { height = 0.4 } }, + }, + left = { + { + title = "Neo-Tree", + ft = "neo-tree", + filter = function(buf) + return vim.b[buf].neo_tree_source == "filesystem" + end, + size = { height = 0.5 }, + }, + { + 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", + }, + { + ft = "Outline", + pinned = true, + open = "SymbolsOutline", + }, + "neo-tree", + }, + }, + }, + + -- 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" } + 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 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] + if sb and #sb.wins > 0 then + local title = " Sidebar" .. string.rep(" ", sb.bounds.width - 8) + ret[pos] = "%#EdgyTitle#" .. title .. "%*" .. "%#WinSeparator#│%*" + ret[pos .. "_size"] = 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, + }, +}