I have been playing with tmux and I'm loving it. However, there's an annoying issue when running vim inside it.

Somehow the arrow keys get remapped, but only on certain times, like when firing up Command-T, if I try to scroll down the file list, the command is cancelled and I'm thrown into insert mode, and depending on the arrow key I pressed, an A, B, C, or D is inserted.

If I use the arrows to move through a buffer for example, they work properly.

Any ideas?

Thanks!

link|improve this question

1  
What is $TERM outside tmux? What about inside? It sounds like something is going on with application and normal keypad modes. – Dennis Williamson Jan 25 '11 at 20:26
Outside tmux: xterm, inside: screen... so if I run TERM=screen vim I see the same behavior, so I must fix screen? – Ivan Jan 26 '11 at 0:49
feedback

4 Answers

up vote 2 down vote accepted

Finally I found my answer here: when running screen on OSX, command+r messes up arrow keys in vim across all screens

The weird thing is I only added ONE mapping to my .vimrc file:

map <Esc>[B <Down>

But that single mapping makes ALL the arrow keys work properly...

link|improve this answer
feedback

I simply added set -g default-terminal "xterm" to my .tmux.conf

This made tmux use xterm instead of screen, so life is beautiful and I don't need to worry about stomping on keybindings.

link|improve this answer
1  
Better like this set -g default-terminal "xterm-256color". Otherwise I couldn't notice when in visual mode due to limited colors. – Macario Feb 18 at 11:39
feedback

Command-T does something dumb by mapping when running in a terminal. It skips the mapping if $TERM is vt100* or xterm*, but that's not a good solution.

link|improve this answer
feedback

The xterm and xterm-256color causes the BCE problem. See http://permalink.gmane.org/gmane.comp.terminal-emulators.tmux.user/1932.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.