From 4b2d4334ca7ab122fb1184dae97b60deb7805935 Mon Sep 17 00:00:00 2001 From: OdysseusOperator Date: Fri, 28 Mar 2025 13:54:08 +0100 Subject: [PATCH] feat(keymap): add F11 and F12 key bindings for completion and Copilot This commit introduces new key mappings for enhanced functionality, specifically the F11 key now confirms suggestions in the completion menu while F12 is set to accept Copilot suggestions in insert mode, improving the user experience for code suggestions. --- init.lua | 2 +- lua/custom/plugins/init.lua | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 44046bf2..6c17411a 100644 --- a/init.lua +++ b/init.lua @@ -867,7 +867,7 @@ require('lazy').setup({ -- This will auto-import if your LSP supports it. -- This will expand snippets if the LSP sent a snippet. [''] = cmp.mapping.confirm { select = true }, - + [''] = cmp.mapping.confirm { select = true }, -- If you prefer more traditional completion keymaps, -- you can uncomment the following lines --[''] = cmp.mapping.confirm { select = true }, diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 3d5536f2..a6bc4964 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -153,6 +153,12 @@ return { vim.keymap.set('n', 'cp', function() vim.cmd [[Copilot toggle]] end, { noremap = true, silent = true, desc = 'Toggle Copilot' }) + + vim.keymap.set('i', '', 'copilot#Accept("\\")', { + expr = true, + replace_keycodes = false, + }) + vim.g.copilot_no_tab_map = true end, }, {