I have Ubuntu 17.04, Tmux: 2.3, vim:8.0, and a colorscheme called onedark
Vim displays right colorscheme when i am not inside TMUX, but when i am inside TMUX, vim looks completely different.
I tired every possible configurations in my .bashrc, .vimrc and .tmux.conf, but no luck. I just recently discovered that when i run vim inside Tmux with sudo, root(administrative) privileges, everything works as expected which i don't think is a good solution.
So my question is how can i make vim display consistent colorscheme regardless of root privilages or weather i am inside or outside of Tmux.
My configurations related to colors are.
.tmux.conf
set-option -sa terminal-overrides ",xterm*:Tc"
set -g default-terminal "xterm-256color"
.vimrc
set encoding=utf-8
set nocompatible
set t_Co=256
set t_ut=
set background=dark
set showmatch
syntax on
if (empty($TMUX))
if (has("nvim"))
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
endif
if (has("termguicolors"))
set termguicolors
endif
endif
colorscheme one
if do echo $TERM
inside or outside of tmux, i get xterm-256color
The culprit is the termguicolors
setting which you enable in terminal but not Tmux. Moving it out of the outermost if
should fix things.