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