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.
This commit is contained in:
parent
21117f7f1e
commit
4b2d4334ca
2
init.lua
2
init.lua
|
@ -867,7 +867,7 @@ require('lazy').setup({
|
||||||
-- This will auto-import if your LSP supports it.
|
-- This will auto-import if your LSP supports it.
|
||||||
-- This will expand snippets if the LSP sent a snippet.
|
-- This will expand snippets if the LSP sent a snippet.
|
||||||
['<C-y>'] = cmp.mapping.confirm { select = true },
|
['<C-y>'] = cmp.mapping.confirm { select = true },
|
||||||
|
['<F11>'] = cmp.mapping.confirm { select = true },
|
||||||
-- If you prefer more traditional completion keymaps,
|
-- If you prefer more traditional completion keymaps,
|
||||||
-- you can uncomment the following lines
|
-- you can uncomment the following lines
|
||||||
--['<CR>'] = cmp.mapping.confirm { select = true },
|
--['<CR>'] = cmp.mapping.confirm { select = true },
|
||||||
|
|
|
@ -153,6 +153,12 @@ return {
|
||||||
vim.keymap.set('n', '<leader>cp', function()
|
vim.keymap.set('n', '<leader>cp', function()
|
||||||
vim.cmd [[Copilot toggle]]
|
vim.cmd [[Copilot toggle]]
|
||||||
end, { noremap = true, silent = true, desc = 'Toggle Copilot' })
|
end, { noremap = true, silent = true, desc = 'Toggle Copilot' })
|
||||||
|
|
||||||
|
vim.keymap.set('i', '<F12>', 'copilot#Accept("\\<CR>")', {
|
||||||
|
expr = true,
|
||||||
|
replace_keycodes = false,
|
||||||
|
})
|
||||||
|
vim.g.copilot_no_tab_map = true
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue