lose vim colorscheme in tmux mode

2019-01-20 20:58发布

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.

17条回答
孤傲高冷的网名
2楼-- · 2019-01-20 21:46

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

查看更多
Luminary・发光体
3楼-- · 2019-01-20 21:47

In order to set up correct color and to get rid of rendering issue in both Ubuntu and Mac:

check this

查看更多
闹够了就滚
4楼-- · 2019-01-20 21:49

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:

  • macOS Sierra 10.12.3
  • iTerm2 3.0.14 (Report Terminal Type is xterm-256color)
  • neovim 0.1.7 (Enable 24-bit color by adding: xterm-256color to .vimrc)
  • tmux 2.3 (Add set -ga terminal-overrides ",xterm-256color:Tc" to .tmux.conf)

Nothing else I need to add in .bashrc or .zshrc.

Hope this could help.

查看更多
Summer. ? 凉城
5楼-- · 2019-01-20 21:49

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

查看更多
萌系小妹纸
6楼-- · 2019-01-20 21:49

Just had to deal with this problem, and although all previously posted answers were helpful, they did not solve the issue in my case.

My problem was fixed by removing the following line in my .vimrc:

set termguicolors

which was redondant with another instruction anyway.

Now, with the following line found in previous anwsers in my .tmux.conf:

export TERM="screen-256color"

all is nice and colorful.

查看更多
登录 后发表回答