vim script for a debian sources.list

Matthijs Mohlmann matthijs at cacholong.nl
Tue Mar 28 17:14:21 UTC 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Pierre Habouzit wrote:
> Le Mar 28 Mars 2006 10:12, Bram Moolenaar a écrit :
>> Matthijs -
>>
>>> I've written a script that highlights the sources.list in Debian. I
>>> would like it if it could be included into the vim 7 release. The
>>> files only exists in two places:
>>> /etc/apt/sources.list and
>>> /etc/apt/sources.list.d/*
>>>
>>> The script is attached on this mail.
>>>
>>> Thanks for considering to include this script.
>> Yes, I can include this.  But first a few remarks.
>>
>> The filetype is "debsources", therefore all the items in the syntax
>> file should start with that, not "sources".  To keep it consistent.
>>
>> The use of HiLink for backwards compatibility with Vim 5.x isn't all
>> that relevant now.  You can use "hi def link" to keep it simple.  I
>> have done that for the C syntax file as well.
>>
>>> " deb-src is a keyword
>>> setlocal iskeyword+=-
>> It appears you hardly use the '-' in a keyword though.  You could
>> also use a match to avoid changing 'iskeyword' from what a user
>> expects.
> 
> yes, in the keywords I suppose there is URL's, and '-' is a valid 
> character in domain names.
> 
>> Aren't there ANY other files in the /etc/apt/sources.list.d/
>> directory?
> not that I can think of.

me neither.

I've updated the syntax file and this is attached to this mail.

Regards,

Matthijs Mohlmann
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEKW7t2n1ROIkXqbARAsmlAJ4zXA/BvU1RHvjviM5ZtPJAx18ZrACgsWMe
qm3c+WBae3wCwjb75auSkFM=
=WHEH
-----END PGP SIGNATURE-----
-------------- next part --------------
" Vim syntax file
" Language:	Debian sources.list
" Maintainer:	Matthijs Mohlmann <matthijs at cacholong.nl>
" Last Change:	$Date: 2006/03/28 18:58:26 $
" URL: http://www.cacholong.nl/~matthijs/vim/syntax/debsources.vim
" $Revision: 1.4 $

" this is a very simple syntax file - I will be improving it
" add entire DEFINE syntax

" Standard syntax initialization
if version < 600
  syntax clear
elseif exists("b:current_syntax")
  finish
endif

" case sensitive
syn case match

" A bunch of useful keywords
syn match debsourcesKeyword        /\(deb-src\|deb\|main\|contrib\|non-free\)/

" Match comments
syn match debsourcesComment        /#.*/

" Match uri's
syn match debsourcesUri            +\(http://\|ftp://\|file:///\)[^' 	<>"]\++
syn match debsourcesDistrKeyword   +\([[:alnum:]_./]*\)\(woody\|sarge\|etch\|old-stable\|stable\|testing\|unstable\|sid\|experimental\|warty\|hoary\|breezy\)\([[:alnum:]_./]*\)+

" Associate our matches and regions with pretty colours
hi def link debsourcesLine            Error
hi def link debsourcesKeyword         Statement
hi def link debsourcesDistrKeyword    Type
hi def link debsourcesComment         Comment
hi def link debsourcesUri             Constant

let b:current_syntax = "debsources"

" vim: ts=8


More information about the pkg-vim-maintainers mailing list