I'm using Terminal on OSX, the same happens on remote Linux.
I don't know about Terminal, but if you are on OSX, your mappings should work out of the box, provided that you use a recent Vim version, and a recent iTerm2 terminal.
You need at least the Vim patch 8.1.2134. Having the patch 8.1.2194 also helps, because it automatically enables the modifyOtherKeys feature on which Vim relies to let the user map various chords.
For iterm2, I think you need at least the version 3.4.0. From the changelog:
- Modifier keys in vim should work better now. CSI
u mode is no longer enabled by a control
sequence. Instead, a "modifyOtherKeys" mode has
been added which is compatible with xterm.
On Linux, xterm also supports the modifyOtherKeys feature.
You are not limited to meta chords. You can map many other chords, like <C-;>
for example:
vim -Nu NONE +'nno <c-;> :echo "c-; was hit"<cr>'
For more info, see :h modifyOtherKeys
.
Alt
(press, not hold) and thenj
work? Withxterm
at least I need to setmetaSendsEscape
totrue
to get these sequences to work... I don't know if you have the same problem, and I don't use OSX so I can't test...Alt
, release, thenj
or any other key works as normal. I've checked and found the option 'Use option as meta key', enabled it and it works now. So settingmetaSendsEscape
did the trick, thanks.Alt-j
andAlt-k
was intercepted by your operating system or your Terminal emulator or both. The intercepted action (Find?) as defined inyour_os->system->settings->keybindings
oryour_terminal->settings->keymaps
will tell you where the keystroke sunk. Delete all entries and vim once again receives your keystroke.