2 " Language: XKB (X Keyboard Extension) components
3 " Maintainer: David Ne\v{c}as (Yeti) <yeti@physics.muni.cz>
4 " Last Change: 2001 Apr 27
5 " URI: http://physics.muni.cz/~yeti/download/xkb.vim
7 " FIXME: I don't fully understand XKB. (But apparently, nobody does.)
8 " So this file highlights something, somehow, at least.
9 " TODO: everything, and add `display' where appropriate
12 " React to possibly already-defined syntax.
13 " For version 5.x: Clear all syntax items unconditionally
14 " For version 6.x: Quit when a syntax file was already loaded
16 if exists("b:current_syntax")
27 syn region xkbComment start="//" skip="\\$" end="$" keepend contains=xkbTodo
28 syn region xkbComment start="/\*" matchgroup=NONE end="\*/" contains=xkbCommentStartError,xkbTodo
29 syn match xkbCommentError "\*/"
30 syntax match xkbCommentStartError "/\*" contained
31 syn sync ccomment xkbComment
32 syn keyword xkbTodo TODO FIXME contained
35 syn match xkbSpecialChar "\\\d\d\d\|\\." contained
36 syn region xkbString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=xkbSpecialChar oneline
38 " Catch errors caused by wrong parenthesization {{{
40 syn region xkbParen start='(' end=')' contains=ALLBUT,xkbParenError,xkbSpecial,xkbTodo transparent
41 syn match xkbParenError ")"
42 " Idem for curly braces
43 syn region xkbBrace start='{' end='}' contains=ALLBUT,xkbBraceError,xkbSpecial,xkbTodo transparent
44 syn match xkbBraceError "}"
46 syn region xkbBracket start='\[' end='\]' contains=ALLBUT,xkbBracketError,xkbSpecial,xkbTodo transparent
47 syn match xkbBracketError "\]"
50 syn match xkbPhysicalKey "<\w\+>"
53 syn keyword xkbPreproc augment include replace
54 syn keyword xkbConstant False True
55 syn keyword xkbModif override replace
56 syn keyword xkbIdentifier action affect alias allowExplicit approx baseColor clearLocks color controls cornerRadius ctrls description driveskbd font fontSize gap group height indicator interpret key keys labelColor latchToLock left level_name map maximum minimum modifier_map modifiers name offColor onColor outline preserve priority repeat row section section shape slant solid symbols text top type useModMapMods virtualModifier virtualMods virtual_modifiers weight whichModState width
57 syn keyword xkbAction ISOLock LatchGroup LatchMods LockControls LockGroup LockMods NoAction SetControls SetGroup SetMods Terminate
58 syn keyword xkbTModif default hidden partial virtual
59 syn keyword xkbSect alphanumeric_keys alternate_group keypad_keys modifier_keys xkb_compatibility xkb_geometry xkb_keycodes xkb_keymap xkb_semantics xkb_symbols xkb_types
61 " Define the default highlighting {{{
62 " For version 5.7 and earlier: Only when not done already
63 " For version 5.8 and later: Only when an item doesn't have highlighting yet
64 if version >= 508 || !exists("did_xkb_syntax_inits")
66 let did_xkb_syntax_inits = 1
67 command -nargs=+ HiLink hi link <args>
69 command -nargs=+ HiLink hi def link <args>
72 HiLink xkbModif xkbPreproc
73 HiLink xkbTModif xkbPreproc
74 HiLink xkbPreproc Preproc
76 HiLink xkbIdentifier Keyword
77 HiLink xkbAction Function
79 HiLink xkbPhysicalKey Identifier
80 HiLink xkbKeyword Keyword
82 HiLink xkbComment Comment
85 HiLink xkbConstant Constant
86 HiLink xkbString String
88 HiLink xkbSpecialChar xkbSpecial
89 HiLink xkbSpecial Special
91 HiLink xkbParenError xkbBalancingError
92 HiLink xkbBraceError xkbBalancingError
93 HiLink xkbBraketError xkbBalancingError
94 HiLink xkbBalancingError xkbError
95 HiLink xkbCommentStartError xkbCommentError
96 HiLink xkbCommentError xkbError
102 let b:current_syntax = "xkb"