What is the correct casing of mapping in vim?

1.4k views Asked by At

I'm confused with these mappings:

map <c-c>
map <C-C>
map <c-C>
map <C-c>

Are they different ? Which is the correct way to write this mapping ?

Same question with:

map <s-Tab>
map <S-TAB>
map <s-tab>
2

There are 2 answers

0
romainl On BEST ANSWER

<C-c>, <c-c>, <c-C> and <C-C> are strictly equivalent but…

  1. Read :help key-notation.

  2. Always use the notation you see in the first column.

  3. ?

  4. Profit.

0
Ingo Karkat On

In general, the case doesn't matter. When you define

:map <c-c> foo

and then list via

:map <c-c>
<C-C>   foo

it shows the uppercase version. So, the modifiers (C for Ctrl, etc.) are case-insensitive. For the keys, you usually use the S modifier (as in <C-S-c>) for shifted keys; however, as a special case, for the <A-...> keys, the uppercase key is different from the lowercase one, i.e. <A-S-c> == <A-C>.

I recommend to adhere to the format used at :help key-notation.