0

While reading the code of some plugins, I found the key <special> being used.

Typing :h <special>, :h <Special> or :h <SPECIAL> yields nothing. I tried to search for it (/\c<special>) in :h map, but found nothing. Neither did I find any reference of it online.

What does it do?

4

The answer is at :help :map-<special> (or :help :map-special, which is easier to type):

                        *:map-<special>* *:map-special*
Define a mapping with <> notation for special keys, even though the "<" flag
may appear in 'cpoptions'.  This is useful if the side effect of setting
'cpoptions' is not desired.  Example: >
    :map <special> <F12> /Header<CR>
<

Some values for cpoptions will not allow <> notation for keys, meaning they have to be entered literally (like the old vi days); e.g., you would put

map - /Header^M

where the ^M is actually a single byte inserted with Ctrl-V Enter.

A mapping with <special> fixes this even when cpoptions wouldn't allow it.

1
  • 1
    PS typing :help special followed by <C-d> shows some options, which is one way to find this topic; also, :helpgrep <special> gets you there almost immediately.
    – D. Ben Knoble
    Jun 19 at 18:28

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.