mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-07-13 19:04:36 +02:00
feat(supermaven): support word-completion
The supermaven-plugin supports partial completion, which is essentially expanding the next word. Configuration is extended to allow word-expansion on S-Tab with blink.
This commit is contained in:
parent
83bf6360a1
commit
17ee28dc4a
2 changed files with 18 additions and 8 deletions
|
@ -20,16 +20,22 @@ return {
|
||||||
"supermaven-inc/supermaven-nvim",
|
"supermaven-inc/supermaven-nvim",
|
||||||
opts = function()
|
opts = function()
|
||||||
require("supermaven-nvim.completion_preview").suggestion_group = "SupermavenSuggestion"
|
require("supermaven-nvim.completion_preview").suggestion_group = "SupermavenSuggestion"
|
||||||
LazyVim.cmp.actions.ai_accept = function()
|
|
||||||
local suggestion = require("supermaven-nvim.completion_preview")
|
local ai_accept = function(partial)
|
||||||
if suggestion.has_suggestion() then
|
return function()
|
||||||
LazyVim.create_undo()
|
local suggestion = require("supermaven-nvim.completion_preview")
|
||||||
vim.schedule(function()
|
if suggestion.has_suggestion() then
|
||||||
suggestion.on_accept_suggestion()
|
LazyVim.create_undo()
|
||||||
end)
|
vim.schedule(function()
|
||||||
return true
|
suggestion.on_accept_suggestion(partial)
|
||||||
|
end)
|
||||||
|
return true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
LazyVim.cmp.actions.ai_accept = ai_accept(false)
|
||||||
|
LazyVim.cmp.actions.ai_accept_word = ai_accept(true)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,10 @@ return {
|
||||||
keymap = {
|
keymap = {
|
||||||
preset = "enter",
|
preset = "enter",
|
||||||
["<C-y>"] = { "select_and_accept" },
|
["<C-y>"] = { "select_and_accept" },
|
||||||
|
["<S-Tab>"] = {
|
||||||
|
LazyVim.cmp.map({ "snippet_backward", "ai_accept_word" }),
|
||||||
|
"fallback",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
---@param opts blink.cmp.Config | { sources: { compat: string[] } }
|
---@param opts blink.cmp.Config | { sources: { compat: string[] } }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue