Minuet autocomplete key
This commit is contained in:
1 parent
849c1048a0
commit
429386b92e
1 file changed
+17
-1
+17
-1
@@ -191,7 +191,8 @@ minuet.setup({
|
||||
auto_trigger_ft = { "*" },
|
||||
auto_trigger_ignore_ft = { "TelescopePrompt", "oil" },
|
||||
keymap = {
|
||||
accept = "<A-a>",
|
||||
-- Tab, mapped below.
|
||||
accept = false,
|
||||
accept_line = "<A-l>",
|
||||
prev = "<A-[>",
|
||||
next = "<A-]>",
|
||||
@@ -236,6 +237,21 @@ minuet.setup({
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- Tab accepts the whole suggestion. With none showing it falls back to the
|
||||
-- built-in snippet jump, then a plain Tab. <C-v><Tab> inserts a literal tab,
|
||||
-- since <C-v> bypasses mappings.
|
||||
local minuet_vt = require("minuet.virtualtext").action
|
||||
vim.keymap.set("i", "<Tab>", function()
|
||||
if minuet_vt.is_visible() then
|
||||
vim.schedule(minuet_vt.accept)
|
||||
return ""
|
||||
end
|
||||
if vim.snippet.active({ direction = 1 }) then
|
||||
return "<Cmd>lua vim.snippet.jump(1)<CR>"
|
||||
end
|
||||
return "<Tab>"
|
||||
end, { expr = true, silent = true, desc = "Accept minuet suggestion, else Tab" })
|
||||
end
|
||||
|
||||
-- Ghost text, dimmer than a comment.
|
||||
|
||||
Reference in new issue
Block a user