3

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

Simon
  • 4,395
  • 8
  • 33
  • 50
  • Why is `TERM=xterm-256color`? Shouldn't it be `screen-256color`, as set in your tmux profile? I think that's the right value! – Ingo Karkat Sep 27 '17 at 16:27
  • True. But why isn't it when I configured it? It is `xterm-256color` inside and outside byobu. – Simon Sep 27 '17 at 16:32

1 Answers1

1

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.

Simon
  • 4,395
  • 8
  • 33
  • 50