Vim not running inside tmux

I solved the issue by adding the line

set -g default-terminal xterm

as the first line of my ~/.tmux.conf and it worked fine.

However as @jasonwryan has pointed out, the TMUX FAQ clearly states that:

Most display problems are due to incorrect TERM! Before reporting problems make SURE that TERM settings are correct inside and outside tmux.

Inside tmux TERM must be "screen" or similar (such as "screen-256color"). Outside, it must match your terminal ...

I only post this answer as it actually solved my problem. please feel free to add your alternative solutions.


I just ran into the same problem on an old CentOS box I had to work on. For me setting TERM in tmux to xterm caused other strange issues to pop up. However, I was able to fix it by commenting out set mouse=a in my .vimrc c.f. https://lists.gnu.org/archive/html/screen-users/2005-04/msg00039.html

Apparently adding set ttymouse=xterm2 to your .vimrc may also do the trick.

For anyone else running into similar issues I recommend temporarily moving your .vimrc to see if something in there is the cause.

Tags:

Vim

Tmux