From 2df7760de0cce99d04dd8bd8bfbfb00187b9dd0e Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Fri, 13 Feb 2026 10:45:18 -0500 Subject: [PATCH] refactor(core): remove Avante and Nap plugins --- lua/community.lua | 6 -- lua/config/terminals.lua | 45 +++++++++++ lua/lazy_setup.lua | 1 - lua/plugins/astrocore.lua | 11 +-- lua/plugins/avante.lua | 105 -------------------------- lua/plugins/dankcolors.lua | 91 ++++++++++++++++++++++ lua/plugins/nap.lua | 149 ------------------------------------- 7 files changed, 138 insertions(+), 270 deletions(-) delete mode 100644 lua/plugins/avante.lua create mode 100644 lua/plugins/dankcolors.lua delete mode 100644 lua/plugins/nap.lua diff --git a/lua/community.lua b/lua/community.lua index 3b4d700..4d90b55 100644 --- a/lua/community.lua +++ b/lua/community.lua @@ -17,17 +17,11 @@ return { { import = "astrocommunity.pack.toml" }, { import = "astrocommunity.pack.typescript" }, { import = "astrocommunity.pack.yaml" }, - { import = "astrocommunity.git.octo-nvim" }, { import = "astrocommunity.bars-and-lines.bufferline-nvim" }, - { import = "astrocommunity.code-runner.overseer-nvim" }, { import = "astrocommunity.completion.blink-cmp" }, { import = "astrocommunity.editing-support.auto-save-nvim" }, { import = "astrocommunity.editing-support.conform-nvim" }, { import = "astrocommunity.lsp.inc-rename-nvim" }, { import = "astrocommunity.lsp.nvim-lsp-file-operations" }, - { import = "astrocommunity.colorscheme.bamboo-nvim" }, { import = "astrocommunity.colorscheme.cyberdream-nvim" }, - { import = "astrocommunity.colorscheme.gruvbox-baby" }, - { import = "astrocommunity.colorscheme.kanagawa-nvim" }, - { import = "astrocommunity.colorscheme.kanagawa-paper-nvim" }, } diff --git a/lua/config/terminals.lua b/lua/config/terminals.lua index 0addeac..65b4a66 100644 --- a/lua/config/terminals.lua +++ b/lua/config/terminals.lua @@ -76,6 +76,34 @@ function M.setup() end, } + -- Opencode Terminal Tab + + -- Opencode Terminal Tab (persistent) + local opencode = Terminal:new { + cmd = "opencode", + hidden = true, + direction = "tab", + close_on_exit = false, + count = 99, -- fixed ID so toggleterm never creates a duplicate + on_open = function(term) + vim.cmd "startinsert!" + vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "close", { noremap = true, silent = true }) + vim.api.nvim_buf_set_keymap( + term.bufnr, + "t", + "", + "tabprevious", + { noremap = true, silent = true } + ) + vim.api.nvim_buf_set_keymap( + term.bufnr, + "n", + "", + "tabprevious", + { noremap = true, silent = true } + ) + end, + } -- Scratch terminal local scratch = Terminal:new { cmd = "zsh", @@ -93,6 +121,23 @@ function M.setup() M.lazydocker_toggle = function() lazydocker:toggle() end M.smartCommit_toggle = function() smartCommit:toggle() end M.scratch_toggle = function() scratch:toggle() end + M.opencode_toggle = function() + if not opencode:is_open() then + opencode:open() + elseif opencode:is_focused() then + vim.cmd "tabprevious" + else + -- Find and switch to the opencode tab + local bufnr = opencode.bufnr + for _, win in ipairs(vim.api.nvim_list_wins()) do + if vim.api.nvim_win_get_buf(win) == bufnr then + vim.api.nvim_set_current_win(win) + vim.cmd "startinsert!" + return + end + end + end + end end return M diff --git a/lua/lazy_setup.lua b/lua/lazy_setup.lua index 9b0a50b..b076d56 100644 --- a/lua/lazy_setup.lua +++ b/lua/lazy_setup.lua @@ -12,7 +12,6 @@ require("lazy").setup({ }, { import = "community" }, { import = "plugins" }, - { import = "plugins.local" }, } --[[@as LazySpec]], { install = { colorscheme = { "cyberdream" } }, ui = { backdrop = 100 }, diff --git a/lua/plugins/astrocore.lua b/lua/plugins/astrocore.lua index 8a44ca4..7031190 100644 --- a/lua/plugins/astrocore.lua +++ b/lua/plugins/astrocore.lua @@ -390,15 +390,7 @@ return { [""] = { function() terminals.scratch_toggle() end, desc = "Open Scratch Terminal" }, -- AI/Assistant mappings (Avante) - [""] = { nil, desc = "Avante AI" }, - [""] = { "AvanteToggle", desc = "Toggle Avante" }, - ["a"] = { "AvanteAsk", desc = "Ask Avante" }, - ["e"] = { "AvanteEdit", desc = "Edit with Avante" }, - ["r"] = { "AvanteRefresh", desc = "Refresh Avante" }, - ["f"] = { "AvanteFocus", desc = "Focus Avante" }, - ["c"] = { "AvanteChat", desc = "Avante Chat" }, - ["s"] = { "AvanteSwitchProvider", desc = "Switch Provider" }, - ["C"] = { "AvanteClear", desc = "Clear Avante" }, + [""] = { terminals.opencode_toggle, desc = "Toggle OpenCode" }, -- UI Toggles with Snacks ["u"] = { desc = "UI Toggles" }, ["ud"] = { @@ -540,6 +532,7 @@ return { }, }, t = { + [""] = { terminals.opencode_toggle, desc = "Toggle OpenCode" }, [""] = { terminals.mk_toggle, desc = "Taskfile Toggle" }, [""] = { "Neotree toggle", desc = "Open Explorer" }, -- Paste from system clipboard diff --git a/lua/plugins/avante.lua b/lua/plugins/avante.lua deleted file mode 100644 index ada6c21..0000000 --- a/lua/plugins/avante.lua +++ /dev/null @@ -1,105 +0,0 @@ ---- Avante.nvim - AI pair programming assistant ---- @module plugins.avante -return { - "yetone/avante.nvim", - -- if you want to build from source then do `make BUILD_FROM_SOURCE=true` - -- ⚠️ must add this setting! ! ! - build = vim.fn.has "win32" ~= 0 and "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" - or "make", - event = "VeryLazy", - version = false, -- Never set this value to "*"! Never! - ---@module 'avante' - ---@type avante.Config - opts = { - -- add any opts here - -- this file can contain specific instructions for your project - instructions_file = "avante.md", - -- for example - provider = "opencode", - acp_providers = { - ["opencode"] = { - command = "opencode", - args = { "acp" }, - }, - }, - -- Keybindings for navigation within Avante windows - mappings = { - --- @class AvanteConflictMappings - diff = { - ours = "co", - theirs = "ct", - all_theirs = "ca", - both = "cb", - cursor = "cc", - next = "]x", - prev = "[x", - }, - suggestion = { - accept = "", - next = "", - prev = "", - dismiss = "", - }, - jump = { - next = "]]", - prev = "[[", - }, - submit = { - normal = "", - insert = "", - }, - sidebar = { - apply_all = "A", - apply_cursor = "a", - switch_windows = "", - reverse_switch_windows = "", - }, - }, - windows = { - position = "right", -- the position of the sidebar - wrap = true, -- similar to vim.o.wrap - width = 26, -- default % based on available width - sidebar_header = { - align = "center", -- left, center, right for title - rounded = true, - }, - }, - }, - dependencies = { - "nvim-lua/plenary.nvim", - "MunifTanjim/nui.nvim", - --- The below dependencies are optional, - "nvim-mini/mini.pick", -- for file_selector provider mini.pick - "nvim-telescope/telescope.nvim", -- for file_selector provider telescope - "hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions - "ibhagwan/fzf-lua", -- for file_selector provider fzf - "stevearc/dressing.nvim", -- for input provider dressing - "folke/snacks.nvim", -- for input provider snacks - "nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons - { - -- support for image pasting - "HakonHarnes/img-clip.nvim", - event = "VeryLazy", - opts = { - -- recommended settings - default = { - embed_image_as_base64 = false, - prompt_for_file_name = false, - drag_and_drop = { - insert_mode = true, - }, - -- required for Windows users - use_absolute_path = true, - }, - }, - }, - { - -- Make sure to set this up properly if you have lazy=true - "MeanderingProgrammer/render-markdown.nvim", - opts = { - file_types = { "markdown", "Avante" }, - }, - ft = { "markdown", "Avante" }, - }, - }, -} diff --git a/lua/plugins/dankcolors.lua b/lua/plugins/dankcolors.lua new file mode 100644 index 0000000..917d4c1 --- /dev/null +++ b/lua/plugins/dankcolors.lua @@ -0,0 +1,91 @@ +return { + { + "RRethy/base16-nvim", + priority = 1000, + config = function() + require('base16-colorscheme').setup({ + base00 = '#0A0A0F', + base01 = '#0A0A0F', + base02 = '#5c6370', + base03 = '#5c6370', + base04 = '#abb2bf', + base05 = '#ffffff', + base06 = '#ffffff', + base07 = '#ffffff', + base08 = '#e05f68', + base09 = '#e05f68', + base0A = '#57e9e8', + base0B = '#8ee086', + base0C = '#38838d', + base0D = '#57e9e8', + base0E = '#2e9986', + base0F = '#2e9986', + }) + + vim.api.nvim_set_hl(0, 'Visual', { + bg = '#5c6370', + fg = '#ffffff', + bold = true + }) + vim.api.nvim_set_hl(0, 'Statusline', { + bg = '#57e9e8', + fg = '#0A0A0F', + }) + vim.api.nvim_set_hl(0, 'LineNr', { fg = '#5c6370' }) + vim.api.nvim_set_hl(0, 'CursorLineNr', { fg = '#38838d', bold = true }) + + vim.api.nvim_set_hl(0, 'Statement', { + fg = '#2e9986', + bold = true + }) + vim.api.nvim_set_hl(0, 'Keyword', { link = 'Statement' }) + vim.api.nvim_set_hl(0, 'Repeat', { link = 'Statement' }) + vim.api.nvim_set_hl(0, 'Conditional', { link = 'Statement' }) + + vim.api.nvim_set_hl(0, 'Function', { + fg = '#57e9e8', + bold = true + }) + vim.api.nvim_set_hl(0, 'Macro', { + fg = '#57e9e8', + italic = true + }) + vim.api.nvim_set_hl(0, '@function.macro', { link = 'Macro' }) + + vim.api.nvim_set_hl(0, 'Type', { + fg = '#38838d', + bold = true, + italic = true + }) + vim.api.nvim_set_hl(0, 'Structure', { link = 'Type' }) + + vim.api.nvim_set_hl(0, 'String', { + fg = '#8ee086', + italic = true + }) + + vim.api.nvim_set_hl(0, 'Operator', { fg = '#abb2bf' }) + vim.api.nvim_set_hl(0, 'Delimiter', { fg = '#abb2bf' }) + vim.api.nvim_set_hl(0, '@punctuation.bracket', { link = 'Delimiter' }) + vim.api.nvim_set_hl(0, '@punctuation.delimiter', { link = 'Delimiter' }) + + vim.api.nvim_set_hl(0, 'Comment', { + fg = '#5c6370', + italic = true + }) + + local current_file_path = vim.fn.stdpath("config") .. "/lua/plugins/dankcolors.lua" + if not _G._matugen_theme_watcher then + local uv = vim.uv or vim.loop + _G._matugen_theme_watcher = uv.new_fs_event() + _G._matugen_theme_watcher:start(current_file_path, {}, vim.schedule_wrap(function() + local new_spec = dofile(current_file_path) + if new_spec and new_spec[1] and new_spec[1].config then + new_spec[1].config() + print("Theme reload") + end + end)) + end + end + } +} diff --git a/lua/plugins/nap.lua b/lua/plugins/nap.lua deleted file mode 100644 index c985f07..0000000 --- a/lua/plugins/nap.lua +++ /dev/null @@ -1,149 +0,0 @@ ---- Nap snippets integration ---- Provides keybinding to insert nap snippets using Snacks picker ---- @module plugins.nap - -return { - "AstroNvim/astrocore", - opts = function(_, opts) - -- Add keybinding for nap snippets picker - opts.mappings = opts.mappings or {} - opts.mappings.n = opts.mappings.n or {} - - opts.mappings.n[""] = { - function() - -- Get current buffer's filetype - local filetype = vim.bo.filetype - - -- Map filetype to common language folder names - local filetype_map = { - typescript = "ts", - javascript = "js", - typescriptreact = "tsx", - javascriptreact = "jsx", - python = "py", - go = "go", - rust = "rs", - lua = "lua", - vim = "vim", - sh = "sh", - bash = "bash", - zsh = "zsh", - c = "c", - cpp = "cpp", - java = "java", - ruby = "rb", - php = "php", - html = "html", - css = "css", - scss = "scss", - json = "json", - yaml = "yaml", - toml = "toml", - markdown = "md", - sql = "sql", - proto = "proto", - } - - local lang = filetype_map[filetype] or filetype - - -- Get list of snippets using nap list - local handle = io.popen("nap list 2>/dev/null") - if not handle then - vim.notify("Failed to execute 'nap list' command", vim.log.levels.ERROR) - return - end - - local output = handle:read("*a") - handle:close() - - if not output or output == "" then - vim.notify("No nap snippets found", vim.log.levels.WARN) - return - end - - -- Parse snippet names - local all_snippets = {} - for line in output:gmatch("[^\r\n]+") do - if line and line ~= "" then - table.insert(all_snippets, line) - end - end - - if #all_snippets == 0 then - vim.notify("No nap snippets found", vim.log.levels.WARN) - return - end - - -- Filter snippets by language/filetype - local filtered_snippets = {} - local snippet_prefix = lang .. "/" - - for _, snippet in ipairs(all_snippets) do - -- Match snippets that start with lang/ or contain .lang extension - if snippet:match("^" .. vim.pesc(snippet_prefix)) - or snippet:match("%." .. vim.pesc(lang) .. "$") - or snippet:match("/" .. vim.pesc(lang) .. "/") - then - table.insert(filtered_snippets, snippet) - end - end - - -- Use filtered snippets if found, otherwise show all - local snippets = #filtered_snippets > 0 and filtered_snippets or all_snippets - local prompt = #filtered_snippets > 0 - and "Select " .. lang .. " snippet:" - or "Select nap snippet (no " .. lang .. " snippets found):" - - -- Use vim.ui.select to pick a snippet - vim.ui.select(snippets, { - prompt = prompt, - format_item = function(item) - return item - end, - }, function(choice) - if not choice then return end - - -- Get the snippet content - local content_handle = io.popen("nap " .. vim.fn.shellescape(choice) .. " 2>/dev/null") - if not content_handle then - vim.notify("Failed to read snippet: " .. choice, vim.log.levels.ERROR) - return - end - - local content = content_handle:read("*a") - content_handle:close() - - if not content or content == "" then - vim.notify("Snippet is empty or not found: " .. choice, vim.log.levels.WARN) - return - end - - -- Insert the snippet content at cursor position - local lines = vim.split(content, "\n", { trimempty = false }) - -- Remove trailing empty line if present - if lines[#lines] == "" then - table.remove(lines) - end - - local cursor = vim.api.nvim_win_get_cursor(0) - local row = cursor[1] - local col = cursor[2] - - -- Insert the lines - vim.api.nvim_buf_set_text(0, row - 1, col, row - 1, col, lines) - - -- Move cursor to end of inserted text - local new_row = row + #lines - 1 - local new_col = #lines[#lines] - if #lines == 1 then - new_col = col + new_col - end - vim.api.nvim_win_set_cursor(0, { new_row, new_col }) - - vim.notify("Inserted snippet: " .. choice, vim.log.levels.INFO) - end) - end, - desc = "Insert nap snippet", - } - end, -}