hilight blocks

2007-04-12 Thread Kirk
Is there any simple way to have custom blocks of code highlighted and the
remaining code outside the blocks not highlighted?
For example:

# file.txt
some plain text
[my-custom-tag] some custom text [/my-custom-tag]
Some more plain text
...
# end of file

So the idea would be to open VIM using file.txt and the code inside the
custom tags would be highlighted.

Thanks,
K




RE: hilight blocks

2007-04-12 Thread Kirk
I like this one, I put it in my local ~/.vimrc file and it works for VIM
(v6.1.3).  But when I load this on another machine running VIM (v6.3) I get
this error:

bash-2.05$ vi file
Error detected while processing /export/home/me/file:
line6:
E28: No such highlight group name: Comment '\[perl]\zs\_.\{-}\ze\[/perl]'
Hit ENTER or type command to continue 

What am I missing?

Contents of .vimrc:

:set number
:set hlsearch
:set incsearch
:set ignorecase
:set shiftwidth=3
match Comment '\[perl]\zs\_.\{-}\ze\[/perl]'



Thanks,
K


 -Original Message-
 From: Gary Johnson [mailto:[EMAIL PROTECTED]
 Sent: Thursday, April 12, 2007 12:05 PM
 To: [EMAIL PROTECTED]
 Subject: Re: hilight blocks
 
 On 2007-04-12, Kirk [EMAIL PROTECTED] wrote:
  Is there any simple way to have custom blocks of code highlighted and
 the
  remaining code outside the blocks not highlighted?
  For example:
 
  # file.txt
  some plain text
  [my-custom-tag] some custom text [/my-custom-tag]
  Some more plain text
  ...
  # end of file
 
  So the idea would be to open VIM using file.txt and the code inside the
  custom tags would be highlighted.
 
 How about this?
 
 match Todo '\[my-custom-tag]\zs\_.\{-}\ze\[/my-custom-tag]'
 
 where you can certainly choose some highlight group other than Todo.
 
 You can put that line just as it is into your .vimrc, or put it in
 an after/ftplugin/txt.vim file, or create an autocommand to invoke
 it on just the files you want.
 
 HTH,
 Gary
 
 --
 Gary Johnson | Agilent Technologies
 [EMAIL PROTECTED] | Mobile Broadband Division
  | Spokane, Washington, USA