I am unable to map <C-/> in Neovim. In particular, it does not work for visual mode. I have created the mappings below:

vim.keymap.set('i', '<C-/>', '<Esc>:Commentary<CR>')    
vim.keymap.set('n', '<C-/>', 'gcc')    
vim.keymap.set('v', '<C-/>', 'gc')

Using vim I have the mapping below, which works fine:

imap <C-_> <Esc>:Commentary<CR>
nmap <C-_> gcc
vmap <C-_> gc

But <C-_> also does not work for Neovim. I can also confirm using <C-V> <C-/> that Neovim indeed sees <C-/> and not <C-_> like vim.

I am aware of this question, but it seems Neovim has different behavior from vim.

Edit: I found out it is a problem with Kitty, other terminals do send <C-_>

1 Answer 1


Setting remap = true solves the issue.

vim.keymap.set('i', '<C-/>', '<Esc>:Commentary<CR>')
vim.keymap.set('n', '<C-/>', 'gcc', { remap = true })
vim.keymap.set('v', '<C-/>', 'gc',  { remap = true })
  • I tried to map gcc to another command and remap=true got it working, but I'm not clear why, can you expand? Oct 16 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.