feat(supermaven): add on-demand autocompletion

Removes inline text suggestion and binds <C-t> to autocomplete. Under
the hood it activates inline text suggestion, accept the suggestion and
then disable it again. It removes the noise of AI text suggestions
while allowing me to take advantage of it when it's useful.
This commit is contained in:
Simon Lasbrugnas 2025-06-25 17:06:51 +02:00
parent e89d37cfec
commit 977f625e5d
Signed by untrusted user who does not match committer: simon
GPG key ID: 86039876BA6ED8DE
2 changed files with 27 additions and 7 deletions

View file

@ -1,10 +1,6 @@
return {
"supermaven-inc/supermaven-nvim",
opts = {
keymaps = {
accept_suggestion = "<C-y>",
clear_suggestion = "<C-]>",
accept_word = "<C-j>",
},
},
config = function()
require("custom.supermaven")
end
}

24
lua/custom/supermaven.lua Normal file
View file

@ -0,0 +1,24 @@
require("supermaven-nvim").setup({
disable_keymaps = true,
disable_inline_completion = true,
log_level = "info",
})
-- Supermaven on-demand configuration
local suggestion = require('supermaven-nvim.completion_preview')
local function on_demand_complete()
vim.g.supermaven_inline_completion_enabled = true
vim.schedule(function()
if suggestion.has_suggestion() then
suggestion.on_accept_suggestion()
end
vim.g.supermaven_inline_completion_enabled = false
end)
return ""
end
vim.keymap.set('i', '<C-t>', on_demand_complete, { expr = true, silent = true, desc = "On-demand Supermaven completion" })