Search code examples
vimcolor-schemetmux

tmux colour scheme changes when opening Vim?


I have an issue where my tmux status bar colour scheme changes after opening Vim and I would prefer it not to.

My tmux status bar colour scheme works fine by itself. See the following image for an example:

...notice the white bar and the blue/black/red sections of the status bar as well, this is all as expected and you can see the settings for this here: https://github.com/Integralist/Fresh-Install/blob/master/Shell/.tmux.conf#L78-L86

When I open Vim inside tmux the status bar colour scheme is overridden by Vim's colour scheme (Tomorrow Night). See the following image for an example:

And when I close Vim the tmux status bar colour scheme stays changed. See the following image for an example:

Again, even if there wasn't a way to prevent Vim from overriding the tmux status bar colour scheme while Vim was open I'd prefer it if there was a way to change the tmux status bar colour scheme back to normal when Vim was closed.

I've tried checking the $TERM env var and it seems it is always set to screen-256color. For example...

  • echo $TERM (tmux only) == screen-256color
  • echo $TERM (Vim only) == screen-256color
  • echo $TERM (Vim inside tmux) == screen-256color
  • echo $TERM (tmux only, but after opening Vim) == screen-256color

My .zshrc file has the following setting: export TERM="screen-256color" you can see the full file here: https://github.com/Integralist/Fresh-Install/blob/master/Shell/.zshrc

My .vimrc file has the following setting: set background=light and colorscheme Tomorrow-Night you can see the full file here: https://github.com/Integralist/Fresh-Install/blob/master/Shell/.vimrc

My .tmux.conf file has the following setting: set -g default-terminal "screen-256color" you can see the full file here: https://github.com/Integralist/Fresh-Install/blob/master/Shell/.tmux.conf

The following is my software set-up:

  • Mac OSX 10.9.2
  • Standard Mac Terminal.app (I don't use iTerm)
  • tmux 1.9a (installed via Homebrew)
  • Vim 7.4 (installed via Homebrew)

Does any one have any suggestions on how to resolve this issue? I'm hoping it's I'm just missing a setting somewhere in the .tmux.conf file to say "don't allow your colours to be overridden" or "when vim is opened, reapply tmux status bar colour scheme".

Any help greatly appreciated. Thanks.


Solution

  • I didn't go deep into your vim config, but in your plugin list I found tmuxline, This plugin applies your vim *-line color theme on your tmux status line. very likely it doesn't restore your original tmux color settings when you exit vim.

    try to disable the plugin and see if it helps.