4

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 '16 at 0:41
4

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? – Otis Wright Mar 31 '16 at 23:56
  • I have modified the answer. try again @OtisWright let me know if it fails. – byaruhaf Apr 1 '16 at 0:00
  • @OtisWright give me more details about your shell and os you are using to run tmux and vim. – byaruhaf Apr 1 '16 at 0:02
  • Hey @byaruhaf I am using oh-my-zsh tmux and vim I am currently getting this error with those settings: /home/otis/.zshrc:4: parse error near ]]'` – Otis Wright Apr 1 '16 at 0:15
  • Hey @OtisWright can you post your .zshrc on a gist or any public paste site. – byaruhaf Apr 1 '16 at 0:23

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