l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
November 4: Social gathering
Next Installfest:
TBD
Latest News:
Oct. 10: LUGOD Installfests coming again soon
Page last updated:
2002 Aug 30 21:54

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
[vox-tech] vim syntax highlighting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vox-tech] vim syntax highlighting



----- Forwarded message from Andy Wergedal <awerg@saclug.com> -----

Date: Wed, 28 Aug 2002 15:49:22 -0700
From: Andy Wergedal <awerg@saclug.com>
To: p@dirac.org
Subject: vim syntax highlighting

Pete,

I would like to make a very simple syntax file for vim so I could use it
for my personal journal.

All I want to do is highlight the individual line in a color based on
the first character of the line.


black background
* red
- Blue
-- green
spaces or alpha characters would be the default font color.

Where should I go to get this information?

-- Andy

----- End forwarded message -----








hi andy,

i'm forwarding this to vox-tech.  i wrote "andy.vim" just now.  here it
is:


" ====================================  CUT HERE  ========
" andy.vim
"
" see mike's reply to my vim question on august 30 for info
" about where to put it.  you can also put it in "." and
" simply type "source andy.vim".
"
" see "help highlight" for more information about colors.
" ========================================================

""" This is the real way of doing things:
" if version < 600
"  syntax clear
" elseif exists("b:current_syntax")
"  finish
" endif

""" But let's keep things simple for now.
syntax clear



""" Case insensitive
" syntax case ignore
""" Case sensitive
syntax case match


" Define color names
"
highlight Black    ctermfg=0  guifg=black
" highlight Black    ctermfg=black  guifg=black
highlight Red      ctermfg=1  guifg=red
" highlight Red      ctermfg=red  guifg=red
highlight Green    ctermfg=2  guifg=green
" highlight Green    ctermfg=green  guifg=green
highlight Yellow   ctermfg=3  guifg=yellow
" highlight Yellow   ctermfg=yellow  guifg=yellow
highlight Blue     ctermfg=4  guifg=blue
" highlight Blue     ctermfg=blue  guifg=blue
highlight Magenta  ctermfg=5  guifg=magenta
" highlight Magenta  ctermfg=magenta  guifg=magenta
highlight Cyan     ctermfg=6  guifg=cyan
" highlight Cyan     ctermfg=cyan  guifg=cyan
highlight White    ctermfg=7  guifg=white
" highlight White    ctermfg=white  guifg=white



" Define words (aRed) to match syntax within document (/^r .*$/).
"
syntax match aRed        /^r .*$/
syntax match aBlue       /^b .*$/
syntax match aGreen      /^g .*$/
syntax match aYellow     /^y .*$/

" Now define colors for the words.
"
highlight link aRed        Red
highlight link aBlue       Blue
highlight link aGreen      green
highlight link aYellow     yellow
" ====================================  CUT HERE  ========


here is an example file you can use this for:

r I shot an arrow into the air,
b If fell to earth, i knew not where;
y For, so swiftly it few, the site
g Could not follow it in its flight.

after typing :source andy.vim, the lines will be red, blue, yellow and
green respectively.

you'll definitely want to tweak this for other things too.  you can have
"bold" or "standout"  and "dark/light" choices.   the vim book by steve
oullaine(sp?) and :help highlight are good resources.

pete


-- 
Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
EDGE Tech Corp.
For donating some give-aways for our meetings.