Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VIM Colorschemes in Screen & PuTTy?

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]

like image 362
Patrick O'Doherty Avatar asked Oct 27 '09 10:10

Patrick O'Doherty


People also ask

Where do I put vim Colorschemes?

View preinstalled color schemes Some color schemes are already installed on your system. You can find those color schemes in the /usr/share/vim/vim*/colors directory as . vim extension.

How do I change the Colorscheme in vim?

You can change color schemes at anytime in vi by typing colorscheme followed by a space and the name of the color scheme. For more color schemes, you can browse this library on the vim website. You can enable or disable colors by simply typing "syntax on" or "syntax off" in vi.

How do I enable syntax highlighting in vim?

After opening login.sh file in vim editor, press ESC key and type ':syntax on' to enable syntax highlighting. The file will look like the following image if syntax highlighting is on. Press ESC key and type, “syntax off” to disable syntax highlighting.

What are the default vim color schemes?

Color Schemes Available in vim: default. delek. desert. elflord.


1 Answers

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"
like image 167
Edd Steel Avatar answered Sep 16 '22 15:09

Edd Steel