]> git.r.bdr.sh - rbdr/dotfiles/blame - vim/syntax/gitconfig.vim
Relative line numbers for vim
[rbdr/dotfiles] / vim / syntax / gitconfig.vim
CommitLineData
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
6if exists("b:current_syntax")
7 finish
8endif
9
10setlocal iskeyword+=-
11setlocal iskeyword-=_
12syn case ignore
13syn sync minlines=10
14
15syn match gitconfigComment "[#;].*"
16syn match gitconfigSection "\%(^\s*\)\@<=\[[a-z0-9.-]\+\]"
17syn match gitconfigSection '\%(^\s*\)\@<=\[[a-z0-9.-]\+ \+\"\%([^\\"]\|\\.\)*"\]'
18syn match gitconfigVariable "\%(^\s*\)\@<=\a\k*\%(\s*\%([=#;]\|$\)\)\@=" nextgroup=gitconfigAssignment skipwhite
19syn region gitconfigAssignment matchgroup=gitconfigNone start=+=\s*+ skip=+\\+ end=+\s*$+ contained contains=gitconfigBoolean,gitconfigNumber,gitConfigString,gitConfigEscape,gitConfigError,gitconfigComment keepend
20syn keyword gitconfigBoolean true false yes no contained
21syn match gitconfigNumber "\d\+" contained
22syn region gitconfigString matchgroup=gitconfigDelim start=+"+ skip=+\\+ end=+"+ matchgroup=gitconfigError end=+[^\\"]\%#\@!$+ contained contains=gitconfigEscape,gitconfigEscapeError
23syn match gitconfigError +\\.+ contained
24syn match gitconfigEscape +\\[\\"ntb]+ contained
25syn match gitconfigEscape +\\$+ contained
26
27hi def link gitconfigComment Comment
28hi def link gitconfigSection Keyword
29hi def link gitconfigVariable Identifier
30hi def link gitconfigBoolean Boolean
31hi def link gitconfigNumber Number
32hi def link gitconfigString String
33hi def link gitconfigDelim Delimiter
34hi def link gitconfigEscape Delimiter
35hi def link gitconfigError Error
36
37let b:current_syntax = "gitconfig"