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 colorscheme appears correct - its only when I'm in tmux mode.
I've tried setting :colorscheme molokai
when in vim (see screenshot below) and it doesn't change - again, the default colorscheme for iterm2 remains.
Am I missing some setting to iterm or tmux.conf? My dotfles are up on github here.
From the tmux man page, adding flag as following:
This
-2
flag forces tmux to run on 256-color mode.This works for me
I didn't have much luck trying to export a different
TERM
or set default-terminal in my.tmux.conf
.My solution for fixing vim colors within tmux was adding this line to
.tmux.conf
:I'm not sure why this override was needed given that my
TERM=xterm
and I have iTerm set to xterm as well, but it seems to work.I've removed the line
set termguicolors
, but it doesn't work. Settingset notermguicolors
instead in the.vimrc
works.I had the same problem. Only difference was I am using
solarize
rather thenmolokai
.To fix the issue, I have set up an alias in
~/.bashrc
:And set up the
default-terminal
option in~/.tmux.conf
:Lastly, do
$ source ~/.bashrc
to load new alias.I tried all the solutions above and what finally worked for me is putting the following lines in
.tmux.conf
:I needed vim to display correctly with tmux in terminal on ubuntu and cygwin/mintty on windows. I got it to work by combining the answers like this.
In .bashrc:
In .vimrc:
based on answers from this question, this Vim wiki page and this block cursor question