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