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
|
2202
|
5 " Last Change: 2010 May 21
|
1623
|
6
|
|
7 if exists("b:current_syntax")
|
2202
|
8 finish
|
1623
|
9 endif
|
|
10
|
|
11 setlocal iskeyword+=-
|
|
12 setlocal iskeyword-=_
|
|
13 syn case ignore
|
|
14 syn sync minlines=10
|
|
15
|
|
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
|
|
27
|
|
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
|
|
37
|
|
38 let b:current_syntax = "gitconfig"
|