30202
|
1 " Vim syntax file
|
|
2 " Language: git attributes
|
|
3 " Maintainer: ObserverOfTime <chronobserver@disroot.org>
|
|
4 " Filenames: .gitattributes, *.git/info/attributes
|
|
5 " Last Change: 2022 Sep 09
|
|
6
|
|
7 if exists('b:current_syntax')
|
|
8 finish
|
|
9 endif
|
|
10
|
|
11 let s:cpo_save = &cpoptions
|
|
12 set cpoptions&vim
|
|
13
|
|
14 " Comment
|
|
15 syn keyword gitattributesTodo contained TODO FIXME XXX
|
|
16 syn match gitattributesComment /^\s*#.*/ contains=gitattributesTodo
|
|
17
|
|
18 " Pattern
|
|
19 syn match gitattributesPattern /^\s*#\@!\(".\+"\|\S\+\)/ skipwhite
|
|
20 \ nextgroup=gitattributesAttrPrefixed,gitattributesAttrAssigned skipwhite
|
|
21 \ contains=gitattributesGlob,gitattributesRange,gitattributesSeparator
|
|
22 syn match gitattributesGlob /\\\@1<![?*]/ contained
|
|
23 syn match gitattributesRange /\\\@1<!\[.\{-}\]/ contained
|
|
24 syn match gitattributesSeparator '/' contained
|
|
25
|
|
26 " Attribute
|
|
27 syn match gitattributesAttrPrefixed /[!-]\?[A-Za-z0-9_.][-A-Za-z0-9_.]*/
|
|
28 \ transparent contained skipwhite
|
|
29 \ nextgroup=gitattributesAttrPrefixed,gitattributesAttrAssigned
|
|
30 \ contains=gitattributesPrefix,gitattributesName
|
|
31 syn match gitattributesAttrAssigned /[A-Za-z0-9_.][-A-Za-z0-9_.]*=\S\+/
|
|
32 \ transparent contained skipwhite
|
|
33 \ nextgroup=gitattributesAttrPrefixed,gitattributesAttrAssigned
|
|
34 \ contains=gitattributesName,gitattributesAssign,gitattributesBoolean,gitattributesString
|
|
35 syn match gitattributesName /[A-Za-z0-9_.][-A-Za-z0-9_.]*/
|
|
36 \ contained nextgroup=gitattributesAssign
|
|
37 syn match gitattributesPrefix /[!-]/ contained
|
|
38 \ nextgroup=gitAttributesName
|
|
39 syn match gitattributesAssign '=' contained
|
|
40 \ nextgroup=gitattributesBoolean,gitattributesString
|
|
41 syn match gitattributesString /=\@1<=\S\+/ contained
|
|
42 syn keyword gitattributesBoolean true false contained
|
|
43
|
|
44 " Macro
|
|
45 syn match gitattributesMacro /^\s*\[attr\]\s*\S\+/
|
|
46 \ nextgroup=gitattributesAttribute skipwhite
|
|
47
|
|
48 hi def link gitattributesAssign Operator
|
|
49 hi def link gitattributesBoolean Boolean
|
|
50 hi def link gitattributesComment Comment
|
|
51 hi def link gitattributesGlob Special
|
|
52 hi def link gitattributesMacro Define
|
|
53 hi def link gitattributesName Identifier
|
|
54 hi def link gitattributesPrefix SpecialChar
|
|
55 hi def link gitattributesRange Special
|
|
56 hi def link gitattributesSeparator Delimiter
|
|
57 hi def link gitattributesString String
|
|
58 hi def link gitattributesTodo Todo
|
|
59
|
|
60 let b:current_syntax = 'gitattributes'
|
|
61
|
|
62 let &cpoptions = s:cpo_save
|
|
63 unlet s:cpo_save
|