I recently noticed Alt (meta) + arrow keys in my vim executes certain actions, but only if in tmux for some reason.
- Alt+Left: Deletes 3 lines. Equivalent to vim
d3d
but works in INSERT mode. - Alt+Right: Deletes 3 lines INSERT line above. Equivalent to vim
d3dO
. - Alt+Up: Go to end of line, INSERT. Equivalent to vim
A
. - Alt+Down: Go back 3 WORDS. Equivalent to vim
3B
.
I have not made any related key bindings in my .tmux.conf
or .vimrc
. These commands aren't in vim register either. What is going on here? What configured these commands?
System Info
- vim: 8.2.3582
- tmux: 3.2_a
- Arch Linux
INSERT mode CTRL-V
Alt+Left ^[[1;3D
Alt+Right ^[[1;3C
Alt+Up ^[[1;3A
Alt+Down ^[[1;3B
environment variable
:echo $TERM
tmux-256color
<C-v>
, followed by<A-Left>
, followed by<CR>
. Do the same for each combo and add a screenshot to your question.TERM
environment variable is not set correctly and Vim isn't understanding the escape sequences your arrow keys send.<C-v>
outputs should give you a hint of what is happening. The odds that doing the same<C-v>
dance outside of tmux having a different result are pretty high. Could you do it and add the result to your post?:echo $TERM
" inside Vim show?