When I load up vim inside tmux there is a background color behind all text as so:

enter image description here

If I load it up not in tmux I get the following:

enter image description here

I want it to be like image 2, I can not understand why tmux is interfering?

  • There are lots of questions and answers of this kind. Have you done a simple search before asking a question? :)
    – tamlok
    Apr 10, 2016 at 0:41

1 Answer 1


Add this line to your tmux.conf file

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

Add the line below to you shells rc file in my case its my .zshrc

if [[ $TERM == xterm ]]; then TERM=xterm-256color; fi

Add the line below to your .vimrc

set t_Co=256

The above configuration works for me, but if this fails try to follow this link for another methor to fix Fixing Vim's Background Color

  • No luck, is there anything special I need to do to enable .tmux.conf in tmux? Mar 31, 2016 at 23:56
  • I have modified the answer. try again @OtisWright let me know if it fails.
    – byaruhaf
    Apr 1, 2016 at 0:00
  • @OtisWright give me more details about your shell and os you are using to run tmux and vim.
    – byaruhaf
    Apr 1, 2016 at 0:02
  • 1
    On my end, aside from the changes above, need to add this in .vimrc also: set term=xterm-256color, so my .tmux.conf still has set -g default-terminal "screen-256color". Setting them both as xterm-256color or screen-256color didn't work. Jan 21, 2021 at 4:28
  • 1
    Same problem with tmux, oh-my-zsh and NeoVim, any solutions for NeoVim?
    – K. Symbol
    Jun 19, 2022 at 7:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.