(Remove html character entities) |
(Change <tt> to <code>, perhaps also minor tweak.) |
||
Line 4: | Line 4: | ||
|previous=1260 |
|previous=1260 |
||
|next=1262 |
|next=1262 |
||
− | |created= |
+ | |created=2006 |
|complexity=intermediate |
|complexity=intermediate |
||
|author=Klaus Ethgen |
|author=Klaus Ethgen |
||
Line 45: | Line 45: | ||
==Comments== |
==Comments== |
||
− | You ought to make it simple: In vimrc: < |
+ | You ought to make it simple: In vimrc: <code>if $TERM =~ /xterm_color256/</code><br> |
− | and set TERM in your bashrc: < |
+ | and set TERM in your bashrc: <code>export TERM=xterm_color256</code> |
---- |
---- |
Latest revision as of 06:16, 13 July 2012
Tip 1261 Printable Monobook Previous Next
created 2006 · complexity intermediate · author Klaus Ethgen · version n/a
I use Vim always in the console and I love to have coloured syntax highlighting. But I also work on several Linux distributions where some have xterm with 16 colours, and others with 256.
So I use the following in my vimrc:
let g:rhrel = -1 if filereadable("/etc/redhat-release") let g:rhrel = 0 if version >= 700 for line in readfile("/etc/redhat-release", '', 1) if line =~ '\Crelease [0-9.]\+' let g:rhrel = substitute(matchstr(line, 'release [0-9.]\+'), 'release ', "", "") endif endfor endif endif if &term == "xterm" if g:rhrel >= 0 && g:rhrel < 5 set t_Co=16 colors white else set t_Co=256 colors morning endif "colors gor else set t_Co=8 " Ist eh default endif
I just searched for useful colour schemes for 8, 16 and 256 colors in the console. The most are not useful as they do often end with, for example, red foreground on red background or such. But this is another problem.
Comments[]
You ought to make it simple: In vimrc: if $TERM =~ /xterm_color256/
and set TERM in your bashrc: export TERM=xterm_color256