I want to map the combination of functions keys and shift/command to make a toggle for vim in macOS default Terminal app.
For example,
map <S-F5> [something Toggle]
or
map <C-S-F5> [something Toggle]
However, in Terminal app, the combination of F5 (~F11) and shift key is simply indicated as tilde (~), so the contents in text files opened with vim become capitalized. In addition, Cmd F5
is the shorcut for VoiceOver, that's why I cannot use <C-S-F5>
for my toggle.
If anyone have an idea, please answer.
Thank you
CodePudding user response:
In general, you should assume that Vim sees the output of the modified keys, not what modifier or key was used. For example, in most context, Vim would see A
when you press Shift A
, not <Shift>
and A
. If your terminal or OS or whatever is set up to send )
when you press Shift A
, then Vim will see )
and have no idea about what you did to send it that )
.
One consequence of that design is a) that a key combo has to send something for it to be mappable, and b) that the "something" in question is distinguishable from other "somethings" sent by other combos.
In practice, TUI Vim is unable to distinguish between <F5>
, <S-F5>
, and <C-S-F5>
, which all send the same character sequence.
FWIW, <C-
is the notation for Ctrl
. The notation for Cmd
is <D-
but TUI Vim never receives Cmd
so you can't use it anyway.
So you can basically forget about:
- Shift Function key,
- Ctrl Function key,
- Ctrl Shift Function key,
- Cmd anything.
NOTE: :help modifyOtherKeys
has recently been added but it seemed to break more things than it fixed in my limited testing. YMMV.