diff --git a/lua/lazyvim/plugins/extras/coding/blink.lua b/lua/lazyvim/plugins/extras/coding/blink.lua index 707d3802..1b0c226c 100644 --- a/lua/lazyvim/plugins/extras/coding/blink.lua +++ b/lua/lazyvim/plugins/extras/coding/blink.lua @@ -23,12 +23,6 @@ return { ---@module 'blink.cmp' ---@type blink.cmp.Config opts = { - -- 'default' for mappings similar to built-in completion - -- 'super-tab' for mappings similar to vscode (tab to accept, arrow keys to navigate) - -- see the "default configuration" section below for full documentation on how to define - -- your own keymap. when defining your own, no keybinds will be assigned automatically. - keymap = "default", - highlight = { -- sets the fallback highlight groups to nvim-cmp's highlight groups -- useful for when your theme doesn't support blink.cmp @@ -51,7 +45,7 @@ return { }, -- experimental auto-brackets support - -- accept = { auto_brackets = { enabled = true } } + accept = { auto_brackets = { enabled = true } }, -- experimental signature help support -- trigger = { signature_help = { enabled = true } } @@ -61,6 +55,24 @@ return { enabled_providers = { "lsp", "path", "snippets", "buffer" }, }, }, + + keymap = { + [""] = { "show", "show_documentation", "hide_documentation" }, + [""] = { "hide" }, + [""] = { "select_and_accept" }, + [""] = { "select_and_accept", "fallback" }, + + [""] = { "select_prev", "fallback" }, + [""] = { "select_next", "fallback" }, + [""] = { "select_prev", "fallback" }, + [""] = { "select_next", "fallback" }, + + [""] = { "scroll_documentation_up", "fallback" }, + [""] = { "scroll_documentation_down", "fallback" }, + + [""] = { "snippet_forward", "fallback" }, + [""] = { "snippet_backward", "fallback" }, + }, }, }, diff --git a/lua/lazyvim/plugins/extras/coding/copilot.lua b/lua/lazyvim/plugins/extras/coding/copilot.lua index 8f0680ea..4d737379 100644 --- a/lua/lazyvim/plugins/extras/coding/copilot.lua +++ b/lua/lazyvim/plugins/extras/coding/copilot.lua @@ -80,4 +80,44 @@ return { }) end, }, + + { + "saghen/blink.cmp", + optional = true, + specs = { + { + "zbirenbaum/copilot.lua", + event = "InsertEnter", + opts = { + suggestion = { + enabled = true, + auto_trigger = true, + keymap = { accept = false }, + }, + }, + }, + }, + opts = { + windows = { + ghost_text = { + enabled = false, + }, + }, + keymap = { + [""] = { + function(cmp) + if cmp.is_in_snippet() then + return cmp.accept() + elseif require("copilot.suggestion").is_visible() then + require("copilot.suggestion").accept() + else + return cmp.select_and_accept() + end + end, + "snippet_forward", + "fallback", + }, + }, + }, + }, } diff --git a/lua/lazyvim/plugins/xtras.lua b/lua/lazyvim/plugins/xtras.lua index 0527dde5..c2b52cb6 100644 --- a/lua/lazyvim/plugins/xtras.lua +++ b/lua/lazyvim/plugins/xtras.lua @@ -4,6 +4,7 @@ local prios = { ["lazyvim.plugins.extras.dap.core"] = 1, ["lazyvim.plugins.extras.ui.edgy"] = 2, ["lazyvim.plugins.extras.lang.typescript"] = 5, + ["lazyvim.plugins.extras.coding.blink"] = 5, ["lazyvim.plugins.extras.formatting.prettier"] = 10, -- default priority is 50 ["lazyvim.plugins.extras.editor.aerial"] = 100,