2 " Language: X resources files like ~/.Xdefaults (xrdb)
3 " Maintainer: Johannes Zellner <johannes@zellner.org>
4 " Author and previous maintainer:
5 " Gautam H. Mudunuri <gmudunur@informatica.com>
6 " Last Change: Di, 09 Mai 2006 23:10:23 CEST
7 " $Id: xdefaults.vim,v 1.5 2007/05/12 13:15:42 vimboss Exp $
11 " xrdb source: ftp://ftp.x.org/pub/R6.4/xc/programs/xrdb/xrdb.c
13 " For version 5.x: Clear all syntax items
14 " For version 6.x: Quit when a syntax file was already loaded
17 elseif exists("b:current_syntax")
25 if !exists("xdefaults_no_colon_errors")
26 " mark lines which do not contain a colon as errors.
27 " This does not really catch all errors but only lines
28 " which contain at least two WORDS and no colon. This
29 " was done this way so that a line is not marked as
30 " error while typing (which would be annoying).
31 syntax match xdefaultsErrorLine "^\s*[a-zA-Z.*]\+\s\+[^: ]\+"
35 " syn region xdefaultsLabel start=+^[^:]\{-}:+he=e-1 skip=+\\+ end="$"
36 syn match xdefaultsLabel +[^:]\{-}:+he=e-1 contains=xdefaultsPunct,xdefaultsSpecial,xdefaultsLineEnd
37 syn region xdefaultsValue keepend start=+:+lc=1 skip=+\\+ end=+$+ contains=xdefaultsSpecial,xdefaultsLabel,xdefaultsLineEnd
39 syn match xdefaultsSpecial contained +#override+
40 syn match xdefaultsSpecial contained +#augment+
41 syn match xdefaultsPunct contained +[.*:]+
42 syn match xdefaultsLineEnd contained +\\$+
43 syn match xdefaultsLineEnd contained +\\n\\$+
44 syn match xdefaultsLineEnd contained +\\n$+
50 " note, that the '!' must be at the very first position of the line
51 syn match xdefaultsComment "^!.*$" contains=xdefaultsTodo,@Spell
53 " lines starting with a '#' mark and which are not preprocessor
54 " lines are skipped. This is not part of the xrdb documentation.
55 " It was reported by Bram Moolenaar and could be confirmed by
56 " having a look at xrdb.c:GetEntries()
57 syn match xdefaultsCommentH "^#.*$"
58 "syn region xdefaultsComment start="^#" end="$" keepend contains=ALL
59 syn region xdefaultsComment start="/\*" end="\*/" contains=xdefaultsTodo,@Spell
61 syntax match xdefaultsCommentError "\*/"
63 syn keyword xdefaultsTodo contained TODO FIXME XXX display
69 syn region xdefaultsPreProc start="^\s*#\s*\(if\|ifdef\|ifndef\|elif\|else\|endif\)\>" skip="\\$" end="$" contains=xdefaultsSymbol
70 if !exists("xdefaults_no_if0")
71 syn region xdefaultsCppOut start="^\s*#\s*if\s\+0\>" end=".\|$" contains=xdefaultsCppOut2
72 syn region xdefaultsCppOut2 contained start="0" end="^\s*#\s*\(endif\>\|else\>\|elif\>\)" contains=xdefaultsCppSkip
73 syn region xdefaultsCppSkip contained start="^\s*#\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*#\s*endif\>" contains=xdefaultsCppSkip
75 syn region xdefaultsIncluded contained start=+"+ skip=+\\\\\|\\"+ end=+"+
76 syn match xdefaultsIncluded contained "<[^>]*>"
77 syn match xdefaultsInclude "^\s*#\s*include\>\s*["<]" contains=xdefaultsIncluded
78 syn cluster xdefaultsPreProcGroup contains=xdefaultsPreProc,xdefaultsIncluded,xdefaultsInclude,xdefaultsDefine
79 syn region xdefaultsDefine start="^\s*#\s*\(define\|undef\)\>" skip="\\$" end="$" contains=ALLBUT,@xdefaultsPreProcGroup,xdefaultsCommentH,xdefaultsErrorLine
80 syn region xdefaultsPreProc start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@xdefaultsPreProcGroup,xdefaultsCommentH,xdefaultsErrorLine
84 " symbols as defined by xrdb
85 syn keyword xdefaultsSymbol contained SERVERHOST
86 syn match xdefaultsSymbol contained "SRVR_[a-zA-Z0-9_]\+"
87 syn keyword xdefaultsSymbol contained HOST
88 syn keyword xdefaultsSymbol contained DISPLAY_NUM
89 syn keyword xdefaultsSymbol contained CLIENTHOST
90 syn match xdefaultsSymbol contained "CLNT_[a-zA-Z0-9_]\+"
91 syn keyword xdefaultsSymbol contained RELEASE
92 syn keyword xdefaultsSymbol contained REVISION
93 syn keyword xdefaultsSymbol contained VERSION
94 syn keyword xdefaultsSymbol contained VENDOR
95 syn match xdefaultsSymbol contained "VNDR_[a-zA-Z0-9_]\+"
96 syn match xdefaultsSymbol contained "EXT_[a-zA-Z0-9_]\+"
97 syn keyword xdefaultsSymbol contained NUM_SCREENS
98 syn keyword xdefaultsSymbol contained SCREEN_NUM
99 syn keyword xdefaultsSymbol contained BITS_PER_RGB
100 syn keyword xdefaultsSymbol contained CLASS
101 syn keyword xdefaultsSymbol contained StaticGray GrayScale StaticColor PseudoColor TrueColor DirectColor
102 syn match xdefaultsSymbol contained "CLASS_\(StaticGray\|GrayScale\|StaticColor\|PseudoColor\|TrueColor\|DirectColor\)"
103 syn keyword xdefaultsSymbol contained COLOR
104 syn match xdefaultsSymbol contained "CLASS_\(StaticGray\|GrayScale\|StaticColor\|PseudoColor\|TrueColor\|DirectColor\)_[0-9]\+"
105 syn keyword xdefaultsSymbol contained HEIGHT
106 syn keyword xdefaultsSymbol contained WIDTH
107 syn keyword xdefaultsSymbol contained PLANES
108 syn keyword xdefaultsSymbol contained X_RESOLUTION
109 syn keyword xdefaultsSymbol contained Y_RESOLUTION
111 " Define the default highlighting.
112 " For version 5.7 and earlier: only when not done already
113 " For version 5.8 and later: only when an item doesn't have highlighting yet
114 if version >= 508 || !exists("did_xdefaults_syntax_inits")
116 let did_xdefaults_syntax_inits = 1
117 command -nargs=+ HiLink hi link <args>
119 command -nargs=+ HiLink hi def link <args>
121 HiLink xdefaultsLabel Type
122 HiLink xdefaultsValue Constant
123 HiLink xdefaultsComment Comment
124 HiLink xdefaultsCommentH xdefaultsComment
125 HiLink xdefaultsPreProc PreProc
126 HiLink xdefaultsInclude xdefaultsPreProc
127 HiLink xdefaultsCppSkip xdefaultsCppOut
128 HiLink xdefaultsCppOut2 xdefaultsCppOut
129 HiLink xdefaultsCppOut Comment
130 HiLink xdefaultsIncluded String
131 HiLink xdefaultsDefine Macro
132 HiLink xdefaultsSymbol Statement
133 HiLink xdefaultsSpecial Statement
134 HiLink xdefaultsErrorLine Error
135 HiLink xdefaultsCommentError Error
136 HiLink xdefaultsPunct Normal
137 HiLink xdefaultsLineEnd Special
138 HiLink xdefaultsTodo Todo
143 let b:current_syntax = "xdefaults"