2 " Language: git config file
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
4 " Filenames: gitconfig, .gitconfig, *.git/config
5 " Last Change: 2009 Dec 24
7 if exists("b:current_syntax")
16 syn match gitconfigComment "[#;].*"
17 syn match gitconfigSection "\%(^\s*\)\@<=\[[a-z0-9.-]\+\]"
18 syn match gitconfigSection '\%(^\s*\)\@<=\[[a-z0-9.-]\+ \+\"\%([^\\"]\|\\.\)*"\]'
19 syn match gitconfigVariable "\%(^\s*\)\@<=\a\k*\%(\s*\%([=#;]\|$\)\)\@=" nextgroup=gitconfigAssignment skipwhite
20 syn region gitconfigAssignment matchgroup=gitconfigNone start=+=\s*+ skip=+\\+ end=+\s*$+ contained contains=gitconfigBoolean,gitconfigNumber,gitConfigString,gitConfigEscape,gitConfigError,gitconfigComment keepend
21 syn keyword gitconfigBoolean true false yes no contained
22 syn match gitconfigNumber "\d\+" contained
23 syn region gitconfigString matchgroup=gitconfigDelim start=+"+ skip=+\\+ end=+"+ matchgroup=gitconfigError end=+[^\\"]\%#\@!$+ contained contains=gitconfigEscape,gitconfigEscapeError
24 syn match gitconfigError +\\.+ contained
25 syn match gitconfigEscape +\\[\\"ntb]+ contained
26 syn match gitconfigEscape +\\$+ contained
28 hi def link gitconfigComment Comment
29 hi def link gitconfigSection Keyword
30 hi def link gitconfigVariable Identifier
31 hi def link gitconfigBoolean Boolean
32 hi def link gitconfigNumber Number
33 hi def link gitconfigString String
34 hi def link gitconfigDelim Delimiter
35 hi def link gitconfigEscape Delimiter
36 hi def link gitconfigError Error
38 let b:current_syntax = "gitconfig"