Search code examples
luaneovimkeymapping

How to set keybinding in Neovim with 'Ctrl+/'


Here is part of my config

local opts = { noremap = true, silent = true }
local keymap = vim.api.nvim_set_keymap
keymap("n","<C-/>",":lua require('Comment.api').toggle_current_linewise()<CR>" ,opts)
keymap("n","<a-/>",":lua require('Comment.api').toggle_current_linewise()<CR>" ,opts)

keymap with alt works but with ctrl does not. I have other commands with ctrl and all of them work except this one

:verbose map <C-/>
    n  <C-/>       * :lua require('Comment.api').toggle_current_linewise()<CR>                                                                                                                                                       
            Last set from ~/.config/nvim/init.lua 

Any idea why it is not working ??


Solution

  • To map /: use <C-_> instead of <C-/>.