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:
parent
e89d37cfec
commit
977f625e5d
2 changed files with 27 additions and 7 deletions
|
|
@ -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
24
lua/custom/supermaven.lua
Normal 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" })
|
||||
Loading…
Reference in a new issue