By default, the Neovim plugin for GitHub Copilot uses the tab key to accept suggestions while in insert mode.

I mapped this to hitting and holding the option key and then the enter key by adding the following lines to a copilot.lua file and requiring it in my init.lua set-up:

-- Use Option + Enter to accept GitHub Copilot suggestions
-- C-CR did not work
vim.api.nvim_set_keymap('i', '<M-CR>', 'copilot#Accept("<CR>")', { expr=true, noremap = true, silent = true })
vim.g.copilot_no_tab_map = true

Originally, I attempted to do the same thing with the control and enter keys, but this didn’t work for reasons that I’m not entirely clear on. Changing <C-CR> to <M-CR> worked, and I moved on.

Using the tab key for Copilot conflicted with my use of nvim-cmp.

I first used :help Copilot for help with remapping, and found:

MAPS                                            *copilot-maps*

                                                *copilot-i_<Tab>*
Copilot.vim uses <Tab> to accept the current suggestion.  If you have an
existing <Tab> map, that will be used as the fallback when no suggestion is
displayed.

                                                *copilot#Accept()*
If you'd rather use a key that isn't <Tab>, define an <expr> map that calls
copilot#Accept().  Here's an example with CTRL-J:
 
        imap <silent><script><expr> <C-J> copilot#Accept("\<CR>")
        let g:copilot_no_tab_map = v:true
 
The argument to copilot#Accept() is the fallback for when no suggestion is
displayed.  In this example, a regular carriage return is used.  If no
fallback is desired, use an argument of "" (an empty string).