1623
|
1 " Vim syntax file
|
|
2 " Language: git config file
|
2034
|
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
1623
|
4 " Filenames: gitconfig, .gitconfig, *.git/config
|
18818
|
5 " Last Change: 2019 Dec 05
|
1623
|
6
|
|
7 if exists("b:current_syntax")
|
2202
|
8 finish
|
1623
|
9 endif
|
|
10
|
|
11 syn case ignore
|
|
12 syn sync minlines=10
|
|
13
|
18186
|
14 syn match gitconfigComment "[#;].*" contains=@Spell
|
1623
|
15 syn match gitconfigSection "\%(^\s*\)\@<=\[[a-z0-9.-]\+\]"
|
|
16 syn match gitconfigSection '\%(^\s*\)\@<=\[[a-z0-9.-]\+ \+\"\%([^\\"]\|\\.\)*"\]'
|
18818
|
17 syn match gitconfigVariable "\%(^\s*\)\@<=\a[a-z0-9-]*\%(\s*\%([=#;]\|$\)\)\@=" nextgroup=gitconfigAssignment skipwhite
|
1623
|
18 syn region gitconfigAssignment matchgroup=gitconfigNone start=+=\s*+ skip=+\\+ end=+\s*$+ contained contains=gitconfigBoolean,gitconfigNumber,gitConfigString,gitConfigEscape,gitConfigError,gitconfigComment keepend
|
|
19 syn keyword gitconfigBoolean true false yes no contained
|
18818
|
20 syn match gitconfigNumber "\<\d\+\>" contained
|
1623
|
21 syn region gitconfigString matchgroup=gitconfigDelim start=+"+ skip=+\\+ end=+"+ matchgroup=gitconfigError end=+[^\\"]\%#\@!$+ contained contains=gitconfigEscape,gitconfigEscapeError
|
|
22 syn match gitconfigError +\\.+ contained
|
|
23 syn match gitconfigEscape +\\[\\"ntb]+ contained
|
|
24 syn match gitconfigEscape +\\$+ contained
|
|
25
|
|
26 hi def link gitconfigComment Comment
|
|
27 hi def link gitconfigSection Keyword
|
|
28 hi def link gitconfigVariable Identifier
|
|
29 hi def link gitconfigBoolean Boolean
|
|
30 hi def link gitconfigNumber Number
|
|
31 hi def link gitconfigString String
|
|
32 hi def link gitconfigDelim Delimiter
|
18818
|
33 hi def link gitconfigEscape Special
|
1623
|
34 hi def link gitconfigError Error
|
|
35
|
|
36 let b:current_syntax = "gitconfig"
|