From 39d374c5d8f57108521f6950941ef6781e632a65 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 23 Jun 2023 07:28:45 -0400 Subject: [PATCH] feat(split-and-window): add edgy.nvim --- .../diagnostics/trouble-nvim/init.lua | 38 ++++++---- .../project/nvim-spectre/init.lua | 60 ++++++++------- .../split-and-window/edgy-nvim/README.md | 5 ++ .../split-and-window/edgy-nvim/init.lua | 75 +++++++++++++++++++ .../utility/noice-nvim/init.lua | 12 +++ 5 files changed, 151 insertions(+), 39 deletions(-) create mode 100644 lua/astrocommunity/split-and-window/edgy-nvim/README.md create mode 100644 lua/astrocommunity/split-and-window/edgy-nvim/init.lua diff --git a/lua/astrocommunity/diagnostics/trouble-nvim/init.lua b/lua/astrocommunity/diagnostics/trouble-nvim/init.lua index 8f831062c..18e4317fb 100644 --- a/lua/astrocommunity/diagnostics/trouble-nvim/init.lua +++ b/lua/astrocommunity/diagnostics/trouble-nvim/init.lua @@ -1,19 +1,29 @@ local prefix = "x" return { - "folke/trouble.nvim", - cmd = { "TroubleToggle", "Trouble" }, - keys = { - { prefix, desc = "Trouble" }, - { prefix .. "X", "TroubleToggle workspace_diagnostics", desc = "Workspace Diagnostics (Trouble)" }, - { prefix .. "x", "TroubleToggle document_diagnostics", desc = "Document Diagnostics (Trouble)" }, - { prefix .. "l", "TroubleToggle loclist", desc = "Location List (Trouble)" }, - { prefix .. "q", "TroubleToggle quickfix", desc = "Quickfix List (Trouble)" }, - }, - opts = { - use_diagnostic_signs = true, - action_keys = { - close = { "q", "" }, - cancel = "", + { + "folke/trouble.nvim", + cmd = { "TroubleToggle", "Trouble" }, + keys = { + { prefix, desc = "Trouble" }, + { prefix .. "X", "TroubleToggle workspace_diagnostics", desc = "Workspace Diagnostics (Trouble)" }, + { prefix .. "x", "TroubleToggle document_diagnostics", desc = "Document Diagnostics (Trouble)" }, + { prefix .. "l", "TroubleToggle loclist", desc = "Location List (Trouble)" }, + { prefix .. "q", "TroubleToggle quickfix", desc = "Quickfix List (Trouble)" }, + }, + opts = { + use_diagnostic_signs = true, + action_keys = { + close = { "q", "" }, + cancel = "", + }, }, }, + { + "folke/edgy.nvim", + optional = true, + opts = function(_, opts) + if not opts.bottom then opts.bottom = {} end + table.insert(opts.bottom, "Trouble") + end, + }, } diff --git a/lua/astrocommunity/project/nvim-spectre/init.lua b/lua/astrocommunity/project/nvim-spectre/init.lua index 1966933fd..7e2eddbdf 100644 --- a/lua/astrocommunity/project/nvim-spectre/init.lua +++ b/lua/astrocommunity/project/nvim-spectre/init.lua @@ -1,30 +1,40 @@ local prefix = "s" return { - "nvim-pack/nvim-spectre", - cmd = "Spectre", - keys = { - { prefix, desc = "Search / Replace", mode = { "n", "x" } }, - { prefix .. "s", function() require("spectre").open() end, desc = "Spectre" }, - { - prefix .. "w", - mode = "x", - function() require("spectre").open_visual { select_word = true } end, - desc = "Spectre (current word)", + { + "nvim-pack/nvim-spectre", + cmd = "Spectre", + keys = { + { prefix, desc = "Search / Replace", mode = { "n", "x" } }, + { prefix .. "s", function() require("spectre").toggle() end, desc = "Toggle Spectre" }, + { + prefix .. "w", + mode = "x", + function() require("spectre").open_visual { select_word = true } end, + desc = "Spectre (current word)", + }, + { prefix .. "f", function() require("spectre").open_file_search() end, desc = "Spectre (current file)" }, }, - { prefix .. "f", function() require("spectre").open_file_search() end, desc = "Spectre (current file)" }, - }, - opts = function() - return { - mapping = { - send_to_qf = { map = "q" }, - replace_cmd = { map = "c" }, - show_option_menu = { map = "o" }, - run_current_replace = { map = "C" }, - run_replace = { map = "R" }, - change_view_mode = { map = "v" }, - resume_last_search = { map = "l" }, - }, - } - end, + opts = function() + return { + mapping = { + send_to_qf = { map = "q" }, + replace_cmd = { map = "c" }, + show_option_menu = { map = "o" }, + run_current_replace = { map = "C" }, + run_replace = { map = "R" }, + change_view_mode = { map = "v" }, + resume_last_search = { map = "l" }, + }, + } + end, + }, + { + "folke/edgy.nvim", + optional = true, + opts = function(_, opts) + if not opts.bottom then opts.bottom = {} end + table.insert(opts.bottom, { ft = "spectre_panel", title = "Search/Replace", size = { height = 0.4 } }) + end, + }, } diff --git a/lua/astrocommunity/split-and-window/edgy-nvim/README.md b/lua/astrocommunity/split-and-window/edgy-nvim/README.md new file mode 100644 index 000000000..7f1e382cb --- /dev/null +++ b/lua/astrocommunity/split-and-window/edgy-nvim/README.md @@ -0,0 +1,5 @@ +# edgy.nvim + +Easily create and manage predefined window layouts, bringing a new edge to your workflow + +**Repository:** diff --git a/lua/astrocommunity/split-and-window/edgy-nvim/init.lua b/lua/astrocommunity/split-and-window/edgy-nvim/init.lua new file mode 100644 index 000000000..b6ff0ed28 --- /dev/null +++ b/lua/astrocommunity/split-and-window/edgy-nvim/init.lua @@ -0,0 +1,75 @@ +return { + { + "nvim-neo-tree/neo-tree.nvim", + opts = { + source_selector = { + winbar = false, + statusline = false, + }, + }, + }, + { + "folke/edgy.nvim", + event = "VeryLazy", + keys = { + -- stylua: ignore + { "E", function() require("edgy").toggle() end, desc = "Toggle Sidebars" }, + { "F", function() require("edgy").select() end, desc = "Pick Sidebar" }, + }, + opts = { + exit_when_last = true, + bottom = { + { 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, + }, + }, + left = { + { + title = "Files", + ft = "neo-tree", + filter = function(buf) return vim.b[buf].neo_tree_source == "filesystem" end, + pinned = true, + open = "Neotree position=left filesystem", + size = { height = 0.5 }, + }, + { + title = "Git Status", + 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 = "Buffers", + ft = "neo-tree", + filter = function(buf) return vim.b[buf].neo_tree_source == "buffers" end, + pinned = true, + open = "Neotree position=top buffers", + }, + "neo-tree", + }, + right = { + { + ft = "aerial", + title = "Symbol Outline", + pinned = true, + open = function() require("aerial").open() end, + }, + }, + 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, + }, + }, + }, +} diff --git a/lua/astrocommunity/utility/noice-nvim/init.lua b/lua/astrocommunity/utility/noice-nvim/init.lua index 04e0a88d6..8f72b49e7 100644 --- a/lua/astrocommunity/utility/noice-nvim/init.lua +++ b/lua/astrocommunity/utility/noice-nvim/init.lua @@ -33,4 +33,16 @@ return { }, init = function() vim.g.lsp_handlers_enabled = false end, }, + { + "folke/edgy.nvim", + optional = true, + opts = function(_, opts) + if not opts.bottom then opts.bottom = {} end + table.insert(opts.bottom, { + ft = "noice", + size = { height = 0.4 }, + filter = function(_, win) return vim.api.nvim_win_get_config(win).relative == "" end, + }) + end, + }, }