From 1994b3f6bbb38f0c6065b6bf53b82de081c5e7c6 Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Mon, 21 Sep 2026 16:32:53 -0400 Subject: [PATCH] feat(plugins): replace NeoCodeium with Supermaven and add Supermaven plugins --- lua/plugins/astrocore.lua | 2 +- lua/plugins/blink-supermaven.lua | 26 +++++++++++++++++++ lua/plugins/neocodeium.lua | 42 ------------------------------ lua/plugins/overseer.lua | 23 +++++++++++++++++ lua/plugins/supermaven.lua | 44 ++++++++++++++++++++++++++++++++ 5 files changed, 94 insertions(+), 43 deletions(-) create mode 100644 lua/plugins/blink-supermaven.lua delete mode 100644 lua/plugins/neocodeium.lua create mode 100644 lua/plugins/overseer.lua create mode 100644 lua/plugins/supermaven.lua diff --git a/lua/plugins/astrocore.lua b/lua/plugins/astrocore.lua index 549daeb..b6bb6bc 100644 --- a/lua/plugins/astrocore.lua +++ b/lua/plugins/astrocore.lua @@ -481,7 +481,7 @@ return { function() require("config.picker").with_trouble "diagnostics" end, desc = "Search diagnostics ( sends to Trouble)", }, - [""] = { "NeoCodeium toggle", desc = "Toggle NeoCodeium" }, + [""] = { "SupermavenToggle", desc = "Toggle Supermaven" }, -- u toggles are mapped through Snacks.toggle in -- config.toggles (called from polish.lua) so which-key renders their diff --git a/lua/plugins/blink-supermaven.lua b/lua/plugins/blink-supermaven.lua new file mode 100644 index 0000000..33c06ef --- /dev/null +++ b/lua/plugins/blink-supermaven.lua @@ -0,0 +1,26 @@ +-- Native supermaven source for blink.cmp (mirrors the astrocommunity blink-copilot pattern). +-- Inline ghost text + accept come from `astrocommunity.completion.supermaven-nvim`; +-- this additionally surfaces supermaven suggestions in the blink menu so / work. +return { + "Huijiro/blink-cmp-supermaven", + lazy = true, + specs = { + { + "saghen/blink.cmp", + optional = true, + opts = { + sources = { + default = { "supermaven" }, + providers = { + supermaven = { + name = "supermaven", + module = "blink-cmp-supermaven", + score_offset = 100, + async = true, + }, + }, + }, + }, + }, + }, +} diff --git a/lua/plugins/neocodeium.lua b/lua/plugins/neocodeium.lua deleted file mode 100644 index 8678925..0000000 --- a/lua/plugins/neocodeium.lua +++ /dev/null @@ -1,42 +0,0 @@ --- AI ghost-text completion via NeoCodeium (Windsurf/Codeium). Replaces --- supermaven. Suggestions render as virtual text only; blink.cmp keeps its --- own menu (ghost_text stays disabled in AstroNvim's blink spec). --- --- Disabled in python buffers and under the LeetCode work directory. Both are --- evaluated by neocodeium on InsertEnter, and `:NeoCodeium enable_buffer` --- still overrides them per buffer. -local leetcode_dir = vim.fn.expand "~/Developer/github.com/prdlk/leetcode/work/" - -local function is_leetcode_buffer(bufnr) - local name = vim.api.nvim_buf_get_name(bufnr) - return name:sub(1, #leetcode_dir) == leetcode_dir -end - --- Insert-mode keys that act on a visible suggestion and otherwise keep their --- native meaning ( backspace, delete word). -local function when_visible(action, fallback) - return function() - local neocodeium = require "neocodeium" - if neocodeium.visible() then - neocodeium[action]() - return "" - end - return fallback - end -end - -return { - "monkoose/neocodeium", - event = "VeryLazy", - cmd = "NeoCodeium", - opts = { - log_level = "warn", - filetypes = { python = false }, - filter = function(bufnr) return not is_leetcode_buffer(bufnr) end, - }, - keys = { - { "", when_visible("accept", ""), mode = "i", expr = true, desc = "Accept AI suggestion" }, - { "", when_visible("accept_word", ""), mode = "i", expr = true, desc = "Accept AI suggestion word" }, - { "", when_visible("clear", ""), mode = "i", expr = true, desc = "Clear AI suggestion" }, - }, -} diff --git a/lua/plugins/overseer.lua b/lua/plugins/overseer.lua new file mode 100644 index 0000000..377fd55 --- /dev/null +++ b/lua/plugins/overseer.lua @@ -0,0 +1,23 @@ +--- overseer.nvim: task output in a Snacks bottom window +--- +--- The astrocommunity pack (community.lua) owns the plugin spec and the +--- M* maps; this layers the `snacks_output` component +--- (lua/overseer/component/snacks_output.lua) onto the default component +--- set so every task shows its terminal buffer in a 24-row window docked at +--- the bottom. / Enter runs a task, see plugins/astrocore.lua. +--- @module plugins.overseer + +return { + "stevearc/overseer.nvim", + ---@type overseer.SetupOpts + opts = { + component_aliases = { + default = { + "on_exit_set_status", + "on_complete_notify", + { "on_complete_dispose", require_view = { "SUCCESS", "FAILURE" } }, + { "snacks_output", height = 24 }, + }, + }, + }, +} diff --git a/lua/plugins/supermaven.lua b/lua/plugins/supermaven.lua new file mode 100644 index 0000000..85626aa --- /dev/null +++ b/lua/plugins/supermaven.lua @@ -0,0 +1,44 @@ +-- Disable supermaven in buffers under the LeetCode work directory, and +-- re-enable it when leaving them. +-- +-- Note: supermaven's built-in `condition` option is one-way — its BufEnter +-- listener gates the restart branch on `vim.g.SUPERMAVEN_DISABLED`, which +-- `api.stop()` itself sets, so once auto-stopped it never comes back. This +-- autocmd owns both directions instead. `vim.g.supermaven_leetcode_stopped` +-- distinguishes our auto-stop from a manual :SupermavenStop, which stays off. +local leetcode_dir = vim.fn.expand "~/Developer/github.com/prdlk/leetcode/work/" + +local function is_leetcode_buffer() + local name = vim.api.nvim_buf_get_name(0) + return name:sub(1, #leetcode_dir) == leetcode_dir +end + +local function sync() + local api = require "supermaven-nvim.api" + if is_leetcode_buffer() then + if api.is_running() then + api.stop() + vim.g.supermaven_leetcode_stopped = true + end + elseif vim.g.supermaven_leetcode_stopped and not api.is_running() then + vim.g.supermaven_leetcode_stopped = nil + api.start() + end +end + +return { + "supermaven-inc/supermaven-nvim", + optional = true, + -- ignore_filetypes gates both the buffer sync (on_update) and the + -- suggestion poll, so python buffers are never sent to the binary + opts = { ignore_filetypes = { python = true } }, + config = function(_, opts) + require("supermaven-nvim").setup(opts) + vim.api.nvim_create_autocmd("BufEnter", { + group = vim.api.nvim_create_augroup("supermaven_leetcode", { clear = true }), + desc = "Toggle supermaven off in LeetCode solution buffers", + callback = sync, + }) + sync() -- plugin loads on VeryLazy; cover the buffer we're already sitting in + end, +}