Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wrong colors in vim over ssh

Tags:

vim

ssh

iterm2

I have OSX Yosemite with iTerm2. I connect via ssh to my virtual machine with Debian 8. When I run vim all colors are messed up.

iTerm2 has xterm-256colors on.

like image 452
Eduard Dyckman Avatar asked Dec 24 '15 14:12

Eduard Dyckman


1 Answers

A number of things can affect your Vim colorscheme.

Make sure iTerm has the terminal type correct. As you indicated already, you use xterm-256color.

Make sure your remote shell has a matching terminal type, which you can verify with echo $TERM. If it is not set already, configure your shell with something like

# For sh, bash, zsh, ksh
export TERM=xterm-256color

# For csh, tcsh
setenv TERM xterm-256color

If the color scheme you are trying to use assumes that 256-color support is available, you may also need to add to your .vimrc:

set t_Co=256

Lastly, color schemes can be affected by the background setting in Vim, which you can set to either dark or light. To see what it's set to,

:set background?

And to set it one way or the other in your .vimrc,

set background=dark

(or light).

like image 121
Dan Lowe Avatar answered Nov 09 '22 07:11

Dan Lowe