summaryrefslogtreecommitdiffstats
path: root/runtime/syntax/gitconfig.vim
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 02:44:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 02:44:24 +0000
commit8baab3c8d7a6f22888bd581cd5c6098fd2e4b5a8 (patch)
tree3537e168b860f2742f6029d70501b5ed7d15d345 /runtime/syntax/gitconfig.vim
parentInitial commit. (diff)
downloadvim-8baab3c8d7a6f22888bd581cd5c6098fd2e4b5a8.tar.xz
vim-8baab3c8d7a6f22888bd581cd5c6098fd2e4b5a8.zip
Adding upstream version 2:8.1.0875.upstream/2%8.1.0875upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'runtime/syntax/gitconfig.vim')
-rw-r--r--runtime/syntax/gitconfig.vim38
1 files changed, 38 insertions, 0 deletions
diff --git a/runtime/syntax/gitconfig.vim b/runtime/syntax/gitconfig.vim
new file mode 100644
index 0000000..c6c56f7
--- /dev/null
+++ b/runtime/syntax/gitconfig.vim
@@ -0,0 +1,38 @@
+" Vim syntax file
+" Language: git config file
+" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
+" Filenames: gitconfig, .gitconfig, *.git/config
+" Last Change: 2010 May 21
+
+if exists("b:current_syntax")
+ finish
+endif
+
+setlocal iskeyword+=-
+setlocal iskeyword-=_
+syn case ignore
+syn sync minlines=10
+
+syn match gitconfigComment "[#;].*"
+syn match gitconfigSection "\%(^\s*\)\@<=\[[a-z0-9.-]\+\]"
+syn match gitconfigSection '\%(^\s*\)\@<=\[[a-z0-9.-]\+ \+\"\%([^\\"]\|\\.\)*"\]'
+syn match gitconfigVariable "\%(^\s*\)\@<=\a\k*\%(\s*\%([=#;]\|$\)\)\@=" nextgroup=gitconfigAssignment skipwhite
+syn region gitconfigAssignment matchgroup=gitconfigNone start=+=\s*+ skip=+\\+ end=+\s*$+ contained contains=gitconfigBoolean,gitconfigNumber,gitConfigString,gitConfigEscape,gitConfigError,gitconfigComment keepend
+syn keyword gitconfigBoolean true false yes no contained
+syn match gitconfigNumber "\d\+" contained
+syn region gitconfigString matchgroup=gitconfigDelim start=+"+ skip=+\\+ end=+"+ matchgroup=gitconfigError end=+[^\\"]\%#\@!$+ contained contains=gitconfigEscape,gitconfigEscapeError
+syn match gitconfigError +\\.+ contained
+syn match gitconfigEscape +\\[\\"ntb]+ contained
+syn match gitconfigEscape +\\$+ contained
+
+hi def link gitconfigComment Comment
+hi def link gitconfigSection Keyword
+hi def link gitconfigVariable Identifier
+hi def link gitconfigBoolean Boolean
+hi def link gitconfigNumber Number
+hi def link gitconfigString String
+hi def link gitconfigDelim Delimiter
+hi def link gitconfigEscape Delimiter
+hi def link gitconfigError Error
+
+let b:current_syntax = "gitconfig"