Vim Tips Wiki
Advertisement

I am using PuTTY in Windows to access UNIX box. I wanted to use vim's color schemes. I tried many different things with no descent result until I find the following code in vim's onlin help. After inserting the following lines in .vimrc , I was finally able to use all the color schemes defined in vim system.

For 16 color display:

if has("terminfo")
 set t_Co=16
 set t_AB=<Esc>[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm
 set t_AF=<Esc>[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm
else
 set t_Co=16
 set t_Sf=<Esc>[3%dm
 set t_Sb=<Esc>[4%dm
endif

[<Esc> is a real escape, type CTRL-V <Esc>]


For 8 color display:

if &term =~ "xterm"
 if has("terminfo")
   set t_Co=8
   set t_Sf=<Esc>[3%p1%dm
   set t_Sb=<Esc>[4%p1%dm
 else
   set t_Co=8
   set t_Sf=<Esc>[3%dm
   set t_Sb=<Esc>[4%dm
 endif
endif

[<Esc> is a real escape, type CTRL-V <Esc>]

Advertisement