I\'m running iterm2 and when I\'m in tmux mode the colorscheme I have set in vim does not show up. Only the color scheme I\'ve set in iterm. If I run vim from shell the colo
I just discovered why I was having a lot of confusion. I, like others here, was having a difficult time getting the default-terminal setting to take effect. I remembered that I had a tmux session in the background. I re-attached my session, closed out my processes, and closed ALL tmux processes. The next time I restarted tmux the default-terminal setting in .tmux.conf
began to take effect. I don't know if others are doing this as well but I recommend closing all tmux processes before modifying the .tmux.conf
file.
I got my setup to work on my local machine (OSX 10.9.5 with iTerm2) without any modification to .bashrc
or .bash_profile
. All I did was add the line set -g default-terminal "xterm-256color"
to ~/.tmux.conf
and restarted all tmux processes.
I got my remote setup (ssh to Ubuntu 14.04) to work exactly the same way without any modifications to .bashrc
. I simply added set -g default-terminal "xterm-256color"
to ~/.tmux.conf
on my remote machine and restarted all remote tmux processes.
You can test what Vim is seeing by doing echo $TERM
from within a tmux session. It kept saying screen
as the value until I restarted all tmux processes, at which point it reflected xterm-256color
as expected.
Hope that helps.
In case anyone needs 24-bit color support:
Tmux supports 24-bit color as of version 2.2. If your terminal supports 24-bit color, add your terminal to the terminal-overrides setting. For example,
set -ga terminal-overrides ",xterm-256color:Tc"
My environment checklist:
xterm-256color
)xterm-256color
to .vimrc
)set -ga terminal-overrides ",xterm-256color:Tc"
to .tmux.conf
)Nothing else I need to add in .bashrc
or .zshrc
.
Hope this could help.
So this a bit on the stale side, but it's might be worth mentioning that using screen will often break the Home and End keys. Using
export TERM="xterm-256color"
in should keep the functionality of these and allow the color scheme (or powerline) to work fine.
Since this is the first result on Google and since none of the above helped..wanted to post this so that someone might find it helpful
in .vimrc
:
set background=dark
set t_Co=256
HTH
I tried all the solutions above and what finally worked for me is putting the following lines in .tmux.conf
:
set -g default-terminal "xterm-256color"
In order to set up correct color and to get rid of rendering issue in both Ubuntu and Mac:
check this