feat(plugins): replace NeoCodeium with Supermaven and add Supermaven plugins
This commit is contained in:
1 parent
11af9682ad
commit
1994b3f6bb
5 files changed
+94
-43
No files matched your search
@@ -481,7 +481,7 @@ return {
|
|||||||
function() require("config.picker").with_trouble "diagnostics" end,
|
function() require("config.picker").with_trouble "diagnostics" end,
|
||||||
desc = "Search diagnostics (<C-t> sends to Trouble)",
|
desc = "Search diagnostics (<C-t> sends to Trouble)",
|
||||||
},
|
},
|
||||||
["<C-a><C-s>"] = { "<Cmd>NeoCodeium toggle<CR>", desc = "Toggle NeoCodeium" },
|
["<C-a><C-s>"] = { "<Cmd>SupermavenToggle<CR>", desc = "Toggle Supermaven" },
|
||||||
|
|
||||||
-- <Leader>u toggles are mapped through Snacks.toggle in
|
-- <Leader>u toggles are mapped through Snacks.toggle in
|
||||||
-- config.toggles (called from polish.lua) so which-key renders their
|
-- config.toggles (called from polish.lua) so which-key renders their
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
-- Native supermaven source for blink.cmp (mirrors the astrocommunity blink-copilot pattern).
|
||||||
|
-- Inline ghost text + <C-l> accept come from `astrocommunity.completion.supermaven-nvim`;
|
||||||
|
-- this additionally surfaces supermaven suggestions in the blink menu so <Tab>/<CR> 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,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -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 (<C-h> backspace, <C-w> 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 = {
|
|
||||||
{ "<C-l>", when_visible("accept", "<C-l>"), mode = "i", expr = true, desc = "Accept AI suggestion" },
|
|
||||||
{ "<C-w>", when_visible("accept_word", "<C-w>"), mode = "i", expr = true, desc = "Accept AI suggestion word" },
|
|
||||||
{ "<C-h>", when_visible("clear", "<C-h>"), mode = "i", expr = true, desc = "Clear AI suggestion" },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
--- overseer.nvim: task output in a Snacks bottom window
|
||||||
|
---
|
||||||
|
--- The astrocommunity pack (community.lua) owns the plugin spec and the
|
||||||
|
--- <Leader>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. <C-m> / 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 },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -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,
|
||||||
|
}
|
||||||
Reference in new issue
Block a user