aboutsummaryrefslogtreecommitdiff
path: root/vim/syntax/paludis-general-conf.vim
blob: f8939b578f33f54e48d8888d4826edb78f259021 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
" Vim syntax file
" Language:	Paludis general.conf files
" Author:	Ciaran McCreesh
" Copyright:	Copyright (c) 2007, 2008, 2010 Ciaran McCreesh
" Licence:	You may redistribute this under the same terms as Vim itself
"
" Syntax highlighting for Paludis general.conf files.
"

if &compatible || v:version < 700
    finish
endif

if exists("b:current_syntax")
  finish
endif

syn region PaludisGeneralConfComment start=/^\s*#/ end=/$/

syn region PaludisGeneralConfKey start=/^\(\s*[^#]\)\@=/ end=/=\@=/
	    \ contains=PaludisGeneralConfKnownKey

syn match PaludisGeneralConfEquals /=/ skipwhite
	    \ nextgroup=PaludisGeneralConfValue

syn region PaludisGeneralConfValue contained start=// end=/$/
	    \ contains=PaludisGeneralConfString,PaludisGeneralConfUnquoted,
	    \    PaludisGeneralConfContinuation,PaludisGeneralConfVariable,
	    \    PaludisGeneralConfEnvVariable
	    \ skipwhite

syn match PaludisGeneralConfContinuation contained /\\$/
	    \ skipnl

syn match PaludisGeneralConfUnquoted contained /[^ \t$"'\\]\+/ skipwhite

syn region PaludisGeneralConfString contained start=/"/ end=/"/
	    \ contains=PaludisGeneralConfVariable,PaludisGeneralConfEnvVariable
	    \ skipwhite

syn keyword PaludisGeneralConfKnownKey contained
	    \ reduced_username portage_compatible distribution world

syn match PaludisGeneralConfVariable contained /\$\({[^{}]\+}\|\(ENV{\)\@!=[a-zA-Z0-9_]\+\)/ skipwhite

syn match PaludisGeneralConfEnvVariable contained /\$\({ENV{[^{}]\+}}\|ENV{[a-zA-Z0-9_]\+}\)/ skipwhite

hi def link PaludisGeneralConfKnownKey         Keyword
hi def link PaludisGeneralConfString           String
hi def link PaludisGeneralConfUnquoted         Constant
hi def link PaludisGeneralConfVariable         Identifier
hi def link PaludisGeneralConfEnvVariable      Statement
hi def link PaludisGeneralConfContinuation     Preproc
hi def link PaludisGeneralConfComment          Comment

let b:current_syntax = "paludis-general-conf"