VIM colour scheme working in puTTY
Getting colours working in VIMin a puTTY session can be a pain. If you use windows as your desktop OS and use PuTTY to access your Unix box/es and want to use Vim’s color schemes, you are going to run in to a lack of colours problem even if you set PuTTY to use 256 or system colours . Next I will show you some code that was found in Vim’s help that will help display more colours.
So insert the following lines into your vimrc and you should be able to use VIM colour schemes
Putty settings: Window, Colours
- [x] Allow terminal to specify ANSI colours
- [x] Allow terminal to specify xterm 256-colour mode
- [x] Bolded text is a different colour
Settings in vimrc:
if &term =~ "xterm"
"256 color --
let &t_Co=256
" restore screen after quitting
set t_ti=ESC7ESC[rESC[?47h t_te=ESC[?47lESC8
if has("terminfo")
let &t_Sf="\ESC[3%p1%dm"
let &t_Sb="\ESC[4%p1%dm"
else
let &t_Sf="\ESC[3%dm"
let &t_Sb="\ESC[4%dm"
endif
endif
For those of you that would like a visual representation, I have made you 5 vim colour charts (256 ) and attached them below. You can recreate the colour charts in vim by using creating the following script and then calling it in vim. so create a script called colour_demo.vim then from vim command prompt write
let num = 255
while num >= 0
exec 'hi col_'.num.' ctermbg='.num.' ctermfg=white'
exec 'syn match col_'.num.' "ctermbg='.num.':...." containedIn=ALL'
call append(0, 'ctermbg='.num.':....')
let num = num - 1
endwhile
:so colour_demo.vim
and it will display the colour charts for you.
This entry was posted on Tuesday, August 17th, 2010 at 11:01 and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.




