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 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
:
set -g terminal-overrides 'xterm:colors=88'
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'm using gnome terminal and this solved the problem, but (0) don't forget to:
killall tmux
(1) Edit .tmux.conf
# 24 bit color
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",*256col*:Tc"
(2) Edit: .vimrc
" Enable true color
if exists('+termguicolors')
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors
endif
Solution posted by rinetd on tmux repo issue: https://github.com/tmux/tmux/issues/1246
From the tmux man page, adding flag as following:
tmux -2
This -2
flag forces tmux to run on 256-color mode.
This works for me
If you use tmuxinator
or mux
, you will need to add these in .bashrc
or .zshrc
:
alias tmux='TERM=screen-256color tmux -2'
alias tmuxinator='TERM=screen-256color tmuxinator'
alias mux='TERM=screen-256color mux'
These forces to use 256-color in terminal.
Then tmux
, tmuxinator
and mux
command will all work.
I have tried all of the instructions above, and I found out the most important thing is I have to explicitly add the following line in my .bashrc file.
export TERM=screen-256color
I don't know why alias tmux="TERM=screen-256color-bce tmux" doesn't work out. I use Sierra 10.12.1.
If you find yourself in the same sitation as me, that none of the above worked.. try this:
in .tmux.conf
:
set -g default-terminal "xterm"
in bash config (maybe .bashrc
or .bash_profile
):
alias tmux="tmux -2"
and then run:
killall tmux
and then relaunch tmux