Use Ctrl-hjkl keys for Copilot suggestions
dblume

dblume commited on 2025-11-10 15:42:00
Showing 1 changed files, with 7 additions and 0 deletions.


On my MacBook with a MS Keyboard with Karabiner mapping Windows, Alt
to the Command Key, I've lot the "Meta" modifier key. So I remap
these Ctrl key combos for Copilot suggestion handling.
... ...
@@ -54,6 +54,13 @@ inoremap <expr> <Tab> pumvisible() ? '<Down>' : '<Tab>'
54 54
 inoremap <expr> <S-Tab> pumvisible() ? '<Up>' : '<S-Tab>'
55 55
 inoremap <expr> <cr> pumvisible() ? '<C-y>' : '<cr>'
56 56
 
57
+" I don't have access to the Meta key on macOS with Microsoft Keyboard and Karabiner.
58
+" Copilot mappings from :help copilot
59
+imap <C-h> <Plug>(copilot-accept-line)
60
+imap <C-j> <Plug>(copilot-next)
61
+imap <C-k> <Plug>(copilot-previous)
62
+imap <C-l> <Plug>(copilot-accept-word)
63
+
57 64
 " https://stevelosh.com/blog/2010/09/coming-home-to-vim/#s3-why-i-came-back-to-vim
58 65
 nnoremap <leader>v <C-w>v:bp<cr><C-w>l
59 66
 nnoremap <C-h> <C-w>h
60 67