Syntax file for sources.list

James Vega jamessan at jamessan.com
Sun Aug 14 15:22:45 UTC 2005


On Sat, Aug 13, 2005 at 05:49:30PM +0200, Matthijs Mohlmann wrote:
> Hi,
>
> I started with writing a syntax file for sources.list and I made a first
> attempt.
>
> As I am not an Ubuntu expert I didn't add the code for Ubuntu to it, but
> if someone know how that works...
>
> Please take a look. Probably it needs more modification and the
> regexpressions needs to be reviewed, but this is a first attempt and I'm
> not an syntax file expert.
>
> Regards,
>
> Matthijs Mohlmann

In order to make things easier to read, I'd suggest using a different
delimeter than '/' for the syntax match lines.  Also, some characters
are escaped which don't need to be escaped.  I also added "old-stable"
to the list of recognized releases.  See my modifications below.

> " Vim syntax file
> " Language:	Debian sources.list
> " Maintainer:	Matthijs Mohlmann <matthijs at cacholong.nl>
> " Last Change:	$Date: 2005/08/13 11:51:26 $
> " URL: http://www.cacholong.nl/~matthijs/vim/syntax/sources.vim
> " $Revision: 1.4 $
>
> " this is a very simple syntax file - I will be improving it
> " add entire DEFINE syntax
>
> " Quit when a syntax file was already loaded
> if version < 600
>   syntax clear
> elseif exists("b:current_syntax")
>   finish
> endif
>
> syn case match
>
> " deb-src is a keyword
> setlocal iskeyword+=-
>
> " A bunch of useful keywords
> syn keyword sourcesKeyword      deb deb-src
> syn keyword sourcesKeyword      main contrib non-free
>
> " Match comments
> syn match sourcesComment        /#.*/
>
> " Match uri's
> syn match sourcesUri            /\(http\:\/\/\|ftp\:\/\/\|file:\/\/\/\)[0-9A-Za-z_\.\/\~]*/
syn match sourcesUri            +\(http://\|ftp://\|file:///\)[0-9A-Za-z_./~]*+
> syn match sourcesDistrKeyword   /\([0-9A-Za-z_\.\/]*\)\(woody\|sarge\|etch\|stable\|testing\|unstable\|sid\|experimental\)\([0-9A-Za-z_\.\/]*\)/
syn match sourcesDistrKeyword   +\([[:alnum:]_./]*\)\(woody\|sarge\|etch\|old-stable\|stable\|testing\|unstable\|sid\|experimental\)\([[:alnum:]_./]*\)+
>
> highlight link sourcesKeyword   Statement
> highlight link sourcesDistrKeyword Type
> highlight link sourcesComment   Comment
> highlight link sourcesUri       Constant
>
> let b:current_syntax = "sources"
>
> " vim: ts=8

James
--
GPG Key: 1024D/61326D40 2003-09-02 James Vega <jamessan at jamessan.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-vim-maintainers/attachments/20050814/971edb4b/attachment.pgp


More information about the pkg-vim-maintainers mailing list