3

I'm wondering if it is possible to map control + forward-slash in vim. The mapping would be for normal mode if that makes a difference.

I have tried <c-/> but that didn't work.

I also tried looking at the :help keycodes docs but was unable to understand if it was possible.

  • 2
    it is often <c-_> – Mass Jul 25 at 17:17
  • You can in xterm, with a recent Vim. You may need to specify the shift modifier, so try <c-s-/> in addition to <c-/>. – user938271 Jul 25 at 20:14
  • @Mass I added your comment as a Community Wiki answer, as I could reproduce it. Not sure if this is the best conduct here, if not please apologize me. I could not find any reference to that, if you have it, please add it. – Quasímodo Jul 25 at 23:11
  • 1
    @Quasímodo seems fine to me; I agree it would be great to have more detail, but answers belong in answers, not comments. – D. Ben Knoble Jul 26 at 13:37
2

Use <C-_>. For example, to map Ctrl/ to :help,

noremap <C-_> :help<CR>

From :help :map-special-keys,

There are three ways to map a special key:

  1. The Vi-compatible method: Map the key code. Often this is a sequence that starts with <Esc>. To enter a mapping like this you type ":map " and then you have to type CTRL-V before hitting the function key. (...)

If I try :map CtrlVCtrl/, I get the ^_ symbol, indicating that the corresponding map is <C-_>. If you get some other sequence, map that instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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