3

I am using konsole-4.14.3, tmux-2.6, vim-7.4.1938 and my shell is bash. Outside tmux, my vim color scheme works properly. However, inside tmux the colors are completely different. I kind of know what the problem is, but not sure how to solve it.

The default $TERM value for my terminal is xterm. If I add

set -g default-terminal screen-256color
set -g terminal-overrides ',screen-256color:Tc'

to my ~/.tmux.conf and export TERM=screen-256color to my ~/.bashrc, vim colors work properly in tmux. However, changing the value of TERM makes line wrapping to stop working both outside and inside tmux.

How should I fix this?

1
  • TERM=xterm describes a terminal supporting 8 (16) colors, whereas TERM=screen-256color describes one with 256-color support. No wonder vim picks a different color scheme upon seeing different terminal capabilities. Since you prefer the one inside tmux, why not set TERM=xterm-256color outside (directly in konsole; I believe this is also the default of newer konsole versions), and of course leave TERM=screen-256color inside tmux as you already have it.
    – egmont
    Nov 9, 2017 at 23:14

1 Answer 1

4

I found a fix. I removed the lines in ~/.tmux.conf that set the terminal to screen-256color so that tmux chooses the default. I did NOT change $TERM in my ~/.bashrc or anywhere else. Then I started tmux with tmux -2 which forces tmux to use 256 colors. Make sure to source your conf with :source-file ~/.tmux.conf and to restart your terminal. Manually setting tmux to screen-256color or xterm-256color did not work for me as it caused line-wrapping to stop working. Note that although my default $TERM value was xterm, konsole would still support 256 colors.

2
  • Works really well
    – Charles Lu
    Feb 18 at 22:41
  • thanks, this really helped
    – mihai
    Feb 24 at 16:38

You must log in to answer this question.

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