Eric Leenman wrote:
Hi Tony,
[snip]
:map <F2><Left> <C-Left>
:map! <F2><Left> <C-Left>
Note that, unlike with the Ctrl, Shift and Alt keys, the sequence
<press F2> <release F2> <press Left> <release Left> _will_ activate
the mapping.
Also, <press F2> <Left> <Left> <release F2> is equivalent to <C-Left> <Left>,
not to <C-Left> <C-Left> (the keyboard generates a "release key" event for F2
but the keyboard driver ignores it).
[snip]
Does this mean that I can't use a mapping for F2 only?
And why is their a ! behind the map in the second line?
Best Regards,
Eric
1. If you have a mapping for <F2> and another for <F2><Left>, the former won't
be recognised until you hit a key (other than <Left>) following the F2 key, or
until you wait longer that 'timeoutlen' milliseconds (if 'timeout' is on). It
might be possible to program a single mapping for <F2> invoking the getchar()
function, but IMHO the game is not worth the candle -- mapping the various F2
+ something combinations is easier to understand and therefore less error-prone.
See
:help map-ambiguous
:help 'timeout'
:help 'timeoutlen'
2. ":map" without an exclamation mark applies to Normal and Visual modes. With
an exclamation mark it applies to Insert/Replace and Command-line modes.
See
:help map-commands
:help map-overview
Best regards,
Tony.