Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I try to open a file using vim inside tmux the whole window freezes. I have to kill the window with C-a &.

Here are my ~/.vimrc settings:

:set autoindent
:set ts=4
:set number
:set shiftwidth=4
:set showmode
:filetype on
:filetype plugin on
:syntax enable
:set mouse=a

and ~/.tmux.conf

# I like Ctrl-a as the default hotkey
unbind C-b
set-option -g prefix C-a

# Split window using | and -
unbind %
bind | split-window -h
bind - split-window -v

# Set status bar
set -g status-bg black
set -g status-fg white
set -g status-left ‘#[fg=green]#H’

# Highlight active window
set-window-option -g window-status-current-bg red

# Makes window numbering start from 1, instead of 0
set -g base-index 1

I am facing the problem in RHEL. However the same config works fine in my Mac. I guess, things were working fine till my RHEL box got restarted and I tried to recover a file in from vi swap file.

Any ideas on how to fix this?

[edit]: I tried ssh to other box inside tmux and running vi there. Works fine in remote box !

[added later] Following the suggestion of @jasonwryan, I added the line set -g default-terminal screen-256color at the end of tmux.conf. That prevented programs like less from working.

echo $TERM inside tmux is "screen" and outside tmux is "xterm".

Searching for $TERM led me to https://wiki.archlinux.org/index.php/Tmux, from where I added the line set -g default-terminal "screen-256color" as the first line of tmux.conf. This made the $TERM inside tmux to "screen-256color". But now when I start vi inside tmux, it displays the following error:

E558: Terminal entry not found in terminfo
'screen-256color' not known. Available builtin terminals are:
defaulting to 'ansi'

Looks like I have solved the issue. Just added set -g default-terminal xterm as the first line of my ~/.tmux.conf and it worked !

share|improve this question
It may not be related, but you should set the correct TERM in tmux with set -g default-terminal screen-256color – jasonwryan May 18 '12 at 7:11
Can you update your question with your $TERM in and outside tmux? – jasonwryan May 18 '12 at 8:48
Outside of tmux, execute 'echo $TERM'. Inside of a tmux session, execute 'echo $TERM'. – uther May 18 '12 at 11:16
You should only set your tmux TERM to a screen derivative: see the FAQ: it will cause you issues down the track otherwise... – jasonwryan May 21 '12 at 7:08
You should write your own answer and post it, with that in it, and then accept it (it's perfectly acceptable to do so). – EightBitTony May 21 '12 at 7:25
up vote 8 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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