Re: [longish] Editing world files in vim: help with Reg.Expr

From: Mike Stilson (mike@velgarian.sytes.net)
Date: 07/04/02


On Thu, Jul 04, 2002 at 01:02:15PM +0200, Vladimir Nano wrote:
>Hallo:-)
>I want to edit world files in vim with my syntax highlighting.
>For example, i have obj file: (it is standard obj file, I added
>bugs for testing)
>-----------------------------------------------
>#2593
>99 key grey metal~
>as~
>19 cdq 16385
>2593 0 0 0
>#2592
>green scale shirt~
>cp~
>9 g 9
>10 0 0 0
>A
>2 3
>#2592
>green scale shirt~
>~
>9 30 9
>10 0 0 0
>E
>green scale shirt~
>this Green dragon scale shirt.
>~
>#

Here's my obj file syntax file..  My obj files are a little bit
different but you should be able to fix it up.  You'll probably need to
change the cconst regexp to match sprintbits (my obj files look more
like this:

-----
#1221
coke machine~
a coke machine~
A coke machine is standing here, waiting for you to BUY cold, refreshing Coca-Cola.~
~
12 2 0 0
0 0 0 0 0
100000 0 0 0 0
T 1221
E
coke machine~
   What?  You've never seen a coke machine?  What kind of a depraived life have
you led?  Get the hell out of the house once in a while!
~
#1290
ashen staff~
an ashen staff~
A long staff is lying on the ground here~
Nothing.
~
5 49217 8193 0
2 4 4 10 0
5 10000 0 0 0
A
4 3
A
3 4
A
9 4
S
26 15 10
--------

" object vnum
syntax match vnum "^#\d\+$"
" For descriptions, aliases, etc.
syntax region Comment start="^[a-zA-Z0-9 ]" end="\~\n"
" our numeric constant lines.
" a little bit of a cludge to get around objects with numbers at the
" start of their descriptions/aliases.
syntax match const "^\(-*\d\+ \)\+-*\d\+"
" Extra Description.
syntax region ExDesc start="^E$" end="^\~"
" Object affects and Weapon spells.
syntax match char "^[AS]$"
" EOF marker
syntax match eof "^\$\~$"
" Triggers
syntax match trig "^T \d\{,5}"
" Set up some colors
highlight ExDesc ctermfg=DarkGreen
highlight const ctermfg=Brown
highlight trig ctermfg=Yellow
highlight vnum ctermfg=Red
highlight eof cterm=bold ctermfg=white ctermbg=red
highlight char ctermfg=DarkRed

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT