Skip to content

Commit 4b2d433

Browse files
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.
1 parent 21117f7 commit 4b2d433

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ require('lazy').setup({
867867
-- This will auto-import if your LSP supports it.
868868
-- This will expand snippets if the LSP sent a snippet.
869869
['<C-y>'] = cmp.mapping.confirm { select = true },
870-
870+
['<F11>'] = cmp.mapping.confirm { select = true },
871871
-- If you prefer more traditional completion keymaps,
872872
-- you can uncomment the following lines
873873
--['<CR>'] = cmp.mapping.confirm { select = true },

lua/custom/plugins/init.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ return {
153153
vim.keymap.set('n', '<leader>cp', function()
154154
vim.cmd [[Copilot toggle]]
155155
end, { noremap = true, silent = true, desc = 'Toggle Copilot' })
156+
157+
vim.keymap.set('i', '<F12>', 'copilot#Accept("\\<CR>")', {
158+
expr = true,
159+
replace_keycodes = false,
160+
})
161+
vim.g.copilot_no_tab_map = true
156162
end,
157163
},
158164
{

0 commit comments

Comments
 (0)