Question

I've been trying to get colourschemes to work properly in VIM when using it over ssh with PuTTy as a client but unfortunately I haven't had much success. I can only get 8bit colours working with PuTTY even though I've enabled 256 colors in putty and set t_Co=256 in VIM. They don't turn out as they should. I've been trying to replicate this setup http://www.interworksinc.com/blogs/ckaukis/2009/06/03/vim-color-schemes-putty but as I say it's been in vain so far.

Has anyone here had success with colourschemes working with VIM in PuTTy? I'd appreciate any advice

Thanks,

Patrick

[EDIT] Turns out I've found the source of the problem. I was using vim in a screen which was breaking the colours. Updated question I guess is, is it possible to have working colors in a screen session? [/EDIT]

Was it helpful?

Solution

Yes, you can do 256 colours with screen, however, this option usually isn't compiled in. Simply compile screen yourself with:

--enable-colors256

Alternatively, you could get a tabbed PuTTy. It has the advantage of ctrl-a going to the beginning of the line, and saves you from many termcap headaches. However, if you like to reconnect to your screen sessions from multiple terminals, there really isn't anything better than screen for the job.

NB. This question probably belongs on Superuser.

OTHER TIPS

As well as compiled support, it may be necessary to add some config to screenrc (I needed to).

http://www.frexx.de/xterm-256-notes/ has a good guide. The relevant part to screen:

By default, screen is not aware that it is running in a 256 color capable xterm. To make programs in screen recognize this feature, you need to set three things in your ~/.screenrc:
# terminfo and termcap for nice 256 color terminal
# allow bold colors - necessary for some reason
attrcolor b ".I" 
# tell screen how to set colors. AB = background, AF=foreground 
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' 
# erase background with current bg color 
defbce "on"

I had same problem on Mac Os, tried some solutions but all tests show that 256 colors not displayed. After that I'm installed screen from brew and all works great. Maybe it's because Mac Os default screen from /usr/bin/ compiled without --enable-colors256 flag.

Solution for mac os: brew install screen

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top