0

Recently I installed tmux on my Ubuntu 16.04.

The terminal screen in tmux shows 256 color correctly however when I opened vim within tmux, the color was different from what it showed when it was run directly on the terminal.

I tried to add

set -g default-terminal "screen-256color" 

in my .tmux.conf file but the problem still exists.

  • my terminal screen in tmux: Terminal screen in tmux
  • vim run directly on the terminal: vim run directly on the terminal
  • vim run within tmux: vim run within tmux

The output of

echo $TERM; tput colors; tput longname
  • outside tmux:
    xterm-256color
    256
    xterm
  • with 256 colors inside tmux:
    screen-256color
    256
    GUN Screen with 256 colors
2
  • All that vim cares about is the $TERM variable. Please provide the output of the following both inside tmux, and outside: echo $TERM; tput colors; tput longname
    – phemmer
    Commented May 25, 2018 at 0:06
  • @Patrick Hi Patrick, here are the output: outside tmux: xterm-256color, 256, xterm with 256 colors inside tmux: screen-256color,256, GUN Screen with 256 colors
    – Dyckia
    Commented May 25, 2018 at 1:02

1 Answer 1

0

Try:

tmux -2

From the man page:

-2            Force tmux to assume the terminal supports 256 colours.

You may also have a problem with your terminfo entry for screen-256color.

Also try:

alias tmux='TERM=xterm-256color tmux -2'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .