Ubuntu 16.04 byobu + tmux + vim background color issue

Viewed 899

I have the often reported issue with background color bleeding in vim when used in byobu with tmux. I tried all different options with setting the 256-color option. Nothing worked.

First of all I should figure out what my setup is. What I know of is, that I am using bash and the default terminal emulator in ubuntu. But am I using xterm? I don't know. And thus I don't know if the guide at https://sunaku.github.io/vim-256color-bce.html would apply.

Further more some answers are a few years old and I am wondering if those would still apply to current setups.

What I know about my environment:

~$ byobu -V
tmux 2.1
~$ tmux -V
tmux 2.1
~$ echo $COLORTERM

~$ echo $TERM
xterm-256color
~$ echo $0
bash
~$
~$ cd .byobu/
~/.byobu$ cat backend 
BYOBU_BACKEND=tmux
~/.byobu$ cat color.tmux 
BYOBU_DARK="\#333333"
BYOBU_LIGHT="\#EEEEEE"
BYOBU_ACCENT="\#75507B"
BYOBU_HIGHLIGHT="\#DD4814"
~/.byobu$ cat profile.tmux 
source $BYOBU_PREFIX/share/byobu/profiles/tmux
set -g default-terminal "screen-256color"

What is missing here that vim lines still display like this:

vim broken in tmux

1 Answers

The problem was the ~/.bashrc. I added some lines for Android SDK, one was setting the $TERM var:

# Android SDK
...
export TERM=xterm-256color
...

As tmux starts a bash in each pane, each bash is reading the ~/.bashrc, overwriting the TERM var set by ~/.byobu/profile.tmux. Removing this line solved the problem.

Related