summaryrefslogtreecommitdiffstats
path: root/syntax
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2013-09-12 17:33:47 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2013-09-12 17:33:47 +0200
commit3bd65161236bf5344619861fbe18b30f5bfd1a23 (patch)
tree7ecdb8efb1f3ef4a290d82e4000d2ff52943308e /syntax
parent5bc380150aee647d26a5a538ed855e9e82dcc7f7 (diff)
downloadvim-polyglot-3bd65161236bf5344619861fbe18b30f5bfd1a23.tar.gz
vim-polyglot-3bd65161236bf5344619861fbe18b30f5bfd1a23.zip
Add git support by tpope-git
Diffstat (limited to '')
-rw-r--r--syntax/git.vim78
-rw-r--r--syntax/gitcommit.vim83
-rw-r--r--syntax/gitconfig.vim38
-rw-r--r--syntax/gitrebase.vim38
-rw-r--r--syntax/gitsendemail.vim19
5 files changed, 256 insertions, 0 deletions
diff --git a/syntax/git.vim b/syntax/git.vim
new file mode 100644
index 00000000..48264c7b
--- /dev/null
+++ b/syntax/git.vim
@@ -0,0 +1,78 @@
+" Vim syntax file
+" Language: generic git output
+" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
+" Last Change: 2010 May 21
+
+if exists("b:current_syntax")
+ finish
+endif
+
+syn case match
+syn sync minlines=50
+
+syn include @gitDiff syntax/diff.vim
+
+syn region gitHead start=/\%^/ end=/^$/
+syn region gitHead start=/\%(^commit \x\{40\}\%(\s*(.*)\)\=$\)\@=/ end=/^$/
+
+" For git reflog and git show ...^{tree}, avoid sync issues
+syn match gitHead /^\d\{6\} \%(\w\{4} \)\=\x\{40\}\%( [0-3]\)\=\t.*/
+syn match gitHead /^\x\{40\} \x\{40}\t.*/
+
+syn region gitDiff start=/^\%(diff --git \)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff fold
+syn region gitDiff start=/^\%(@@ -\)\@=/ end=/^\%(diff --\%(git\|cc\|combined\) \|$\)\@=/ contains=@gitDiff
+
+syn region gitDiffMerge start=/^\%(diff --\%(cc\|combined\) \)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff
+syn region gitDiffMerge start=/^\%(@@@@* -\)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff
+syn match gitDiffAdded "^ \++.*" contained containedin=gitDiffMerge
+syn match gitDiffRemoved "^ \+-.*" contained containedin=gitDiffMerge
+
+syn match gitKeyword /^\%(object\|type\|tag\|commit\|tree\|parent\|encoding\)\>/ contained containedin=gitHead nextgroup=gitHash,gitType skipwhite
+syn match gitKeyword /^\%(tag\>\|ref:\)/ contained containedin=gitHead nextgroup=gitReference skipwhite
+syn match gitKeyword /^Merge:/ contained containedin=gitHead nextgroup=gitHashAbbrev skipwhite
+syn match gitMode /^\d\{6\}/ contained containedin=gitHead nextgroup=gitType,gitHash skipwhite
+syn match gitIdentityKeyword /^\%(author\|committer\|tagger\)\>/ contained containedin=gitHead nextgroup=gitIdentity skipwhite
+syn match gitIdentityHeader /^\%(Author\|Commit\|Tagger\):/ contained containedin=gitHead nextgroup=gitIdentity skipwhite
+syn match gitDateHeader /^\%(AuthorDate\|CommitDate\|Date\):/ contained containedin=gitHead nextgroup=gitDate skipwhite
+
+syn match gitReflogHeader /^Reflog:/ contained containedin=gitHead nextgroup=gitReflogMiddle skipwhite
+syn match gitReflogHeader /^Reflog message:/ contained containedin=gitHead skipwhite
+syn match gitReflogMiddle /\S\+@{\d\+} (/he=e-2 nextgroup=gitIdentity
+
+syn match gitDate /\<\u\l\l \u\l\l \d\=\d \d\d:\d\d:\d\d \d\d\d\d [+-]\d\d\d\d/ contained
+syn match gitDate /-\=\d\+ [+-]\d\d\d\d\>/ contained
+syn match gitDate /\<\d\+ \l\+ ago\>/ contained
+syn match gitType /\<\%(tag\|commit\|tree\|blob\)\>/ contained nextgroup=gitHash skipwhite
+syn match gitStage /\<\d\t\@=/ contained
+syn match gitReference /\S\+\S\@!/ contained
+syn match gitHash /\<\x\{40\}\>/ contained nextgroup=gitIdentity,gitStage,gitHash skipwhite
+syn match gitHash /^\<\x\{40\}\>/ containedin=gitHead contained nextgroup=gitHash skipwhite
+syn match gitHashAbbrev /\<\x\{4,40\}\>/ contained nextgroup=gitHashAbbrev skipwhite
+syn match gitHashAbbrev /\<\x\{4,39\}\.\.\./he=e-3 contained nextgroup=gitHashAbbrev skipwhite
+
+syn match gitIdentity /\S.\{-\} <[^>]*>/ contained nextgroup=gitDate skipwhite
+syn region gitEmail matchgroup=gitEmailDelimiter start=/</ end=/>/ keepend oneline contained containedin=gitIdentity
+
+syn match gitNotesHeader /^Notes:\ze\n /
+
+hi def link gitDateHeader gitIdentityHeader
+hi def link gitIdentityHeader gitIdentityKeyword
+hi def link gitIdentityKeyword Label
+hi def link gitNotesHeader gitKeyword
+hi def link gitReflogHeader gitKeyword
+hi def link gitKeyword Keyword
+hi def link gitIdentity String
+hi def link gitEmailDelimiter Delimiter
+hi def link gitEmail Special
+hi def link gitDate Number
+hi def link gitMode Number
+hi def link gitHashAbbrev gitHash
+hi def link gitHash Identifier
+hi def link gitReflogMiddle gitReference
+hi def link gitReference Function
+hi def link gitStage gitType
+hi def link gitType Type
+hi def link gitDiffAdded diffAdded
+hi def link gitDiffRemoved diffRemoved
+
+let b:current_syntax = "git"
diff --git a/syntax/gitcommit.vim b/syntax/gitcommit.vim
new file mode 100644
index 00000000..83cd4733
--- /dev/null
+++ b/syntax/gitcommit.vim
@@ -0,0 +1,83 @@
+" Vim syntax file
+" Language: git commit file
+" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
+" Filenames: *.git/COMMIT_EDITMSG
+" Last Change: 2012 April 7
+
+if exists("b:current_syntax")
+ finish
+endif
+
+syn case match
+syn sync minlines=50
+
+if has("spell")
+ syn spell toplevel
+endif
+
+syn include @gitcommitDiff syntax/diff.vim
+syn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|#\)\@=/ fold contains=@gitcommitDiff
+
+syn match gitcommitFirstLine "\%^[^#].*" nextgroup=gitcommitBlank skipnl
+syn match gitcommitSummary "^.\{0,50\}" contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell
+syn match gitcommitOverflow ".*" contained contains=@Spell
+syn match gitcommitBlank "^[^#].*" contained contains=@Spell
+syn match gitcommitComment "^#.*"
+syn match gitcommitHead "^\%(# .*\n\)\+#$" contained transparent
+syn match gitcommitOnBranch "\%(^# \)\@<=On branch" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
+syn match gitcommitOnBranch "\%(^# \)\@<=Your branch .\{-\} '" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
+syn match gitcommitBranch "[^ ']\+" contained
+syn match gitcommitNoBranch "\%(^# \)\@<=Not currently on any branch." contained containedin=gitcommitComment
+syn match gitcommitHeader "\%(^# \)\@<=.*:$" contained containedin=gitcommitComment
+syn region gitcommitAuthor matchgroup=gitCommitHeader start=/\%(^# \)\@<=\%(Author\|Committer\):/ end=/$/ keepend oneline contained containedin=gitcommitComment transparent
+syn match gitcommitNoChanges "\%(^# \)\@<=No changes$" contained containedin=gitcommitComment
+
+syn region gitcommitUntracked start=/^# Untracked files:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUntrackedFile fold
+syn match gitcommitUntrackedFile "\t\@<=.*" contained
+
+syn region gitcommitDiscarded start=/^# Change\%(s not staged for commit\|d but not updated\):/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitDiscardedType fold
+syn region gitcommitSelected start=/^# Changes to be committed:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitSelectedType fold
+syn region gitcommitUnmerged start=/^# Unmerged paths:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUnmergedType fold
+
+syn match gitcommitDiscardedType "\t\@<=[a-z][a-z ]*[a-z]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitDiscardedFile skipwhite
+syn match gitcommitSelectedType "\t\@<=[a-z][a-z ]*[a-z]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitSelectedFile skipwhite
+syn match gitcommitUnmergedType "\t\@<=[a-z][a-z ]*[a-z]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitUnmergedFile skipwhite
+syn match gitcommitDiscardedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitDiscardedArrow
+syn match gitcommitSelectedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow
+syn match gitcommitUnmergedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow
+syn match gitcommitDiscardedArrow " -> " contained nextgroup=gitcommitDiscardedFile
+syn match gitcommitSelectedArrow " -> " contained nextgroup=gitcommitSelectedFile
+syn match gitcommitUnmergedArrow " -> " contained nextgroup=gitcommitSelectedFile
+
+syn match gitcommitWarning "\%^[^#].*: needs merge$" nextgroup=gitcommitWarning skipnl
+syn match gitcommitWarning "^[^#].*: needs merge$" nextgroup=gitcommitWarning skipnl contained
+syn match gitcommitWarning "^\%(no changes added to commit\|nothing \%(added \)\=to commit\)\>.*\%$"
+
+hi def link gitcommitSummary Keyword
+hi def link gitcommitComment Comment
+hi def link gitcommitUntracked gitcommitComment
+hi def link gitcommitDiscarded gitcommitComment
+hi def link gitcommitSelected gitcommitComment
+hi def link gitcommitUnmerged gitcommitComment
+hi def link gitcommitOnBranch Comment
+hi def link gitcommitBranch Special
+hi def link gitcommitNoBranch gitCommitBranch
+hi def link gitcommitDiscardedType gitcommitType
+hi def link gitcommitSelectedType gitcommitType
+hi def link gitcommitUnmergedType gitcommitType
+hi def link gitcommitType Type
+hi def link gitcommitNoChanges gitcommitHeader
+hi def link gitcommitHeader PreProc
+hi def link gitcommitUntrackedFile gitcommitFile
+hi def link gitcommitDiscardedFile gitcommitFile
+hi def link gitcommitSelectedFile gitcommitFile
+hi def link gitcommitUnmergedFile gitcommitFile
+hi def link gitcommitFile Constant
+hi def link gitcommitDiscardedArrow gitcommitArrow
+hi def link gitcommitSelectedArrow gitcommitArrow
+hi def link gitcommitUnmergedArrow gitcommitArrow
+hi def link gitcommitArrow gitcommitComment
+"hi def link gitcommitOverflow Error
+hi def link gitcommitBlank Error
+
+let b:current_syntax = "gitcommit"
diff --git a/syntax/gitconfig.vim b/syntax/gitconfig.vim
new file mode 100644
index 00000000..c6c56f77
--- /dev/null
+++ b/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"
diff --git a/syntax/gitrebase.vim b/syntax/gitrebase.vim
new file mode 100644
index 00000000..08464563
--- /dev/null
+++ b/syntax/gitrebase.vim
@@ -0,0 +1,38 @@
+" Vim syntax file
+" Language: git rebase --interactive
+" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
+" Filenames: git-rebase-todo
+" Last Change: 2012 April 7
+
+if exists("b:current_syntax")
+ finish
+endif
+
+syn case match
+
+syn match gitrebaseHash "\v<\x{7,40}>" contained
+syn match gitrebaseCommit "\v<\x{7,40}>" nextgroup=gitrebaseSummary skipwhite
+syn match gitrebasePick "\v^p%(ick)=>" nextgroup=gitrebaseCommit skipwhite
+syn match gitrebaseReword "\v^r%(eword)=>" nextgroup=gitrebaseCommit skipwhite
+syn match gitrebaseEdit "\v^e%(dit)=>" nextgroup=gitrebaseCommit skipwhite
+syn match gitrebaseSquash "\v^s%(quash)=>" nextgroup=gitrebaseCommit skipwhite
+syn match gitrebaseFixup "\v^f%(ixup)=>" nextgroup=gitrebaseCommit skipwhite
+syn match gitrebaseExec "\v^%(x|exec)>" nextgroup=gitrebaseCommand skipwhite
+syn match gitrebaseSummary ".*" contains=gitrebaseHash contained
+syn match gitrebaseCommand ".*" contained
+syn match gitrebaseComment "^#.*" contains=gitrebaseHash
+syn match gitrebaseSquashError "\v%^%(s%(quash)=>|f%(ixup)=>)" nextgroup=gitrebaseCommit skipwhite
+
+hi def link gitrebaseCommit gitrebaseHash
+hi def link gitrebaseHash Identifier
+hi def link gitrebasePick Statement
+hi def link gitrebaseReword Number
+hi def link gitrebaseEdit PreProc
+hi def link gitrebaseSquash Type
+hi def link gitrebaseFixup Special
+hi def link gitrebaseExec Function
+hi def link gitrebaseSummary String
+hi def link gitrebaseComment Comment
+hi def link gitrebaseSquashError Error
+
+let b:current_syntax = "gitrebase"
diff --git a/syntax/gitsendemail.vim b/syntax/gitsendemail.vim
new file mode 100644
index 00000000..8b938116
--- /dev/null
+++ b/syntax/gitsendemail.vim
@@ -0,0 +1,19 @@
+" Vim syntax file
+" Language: git send-email message
+" Maintainer: Tim Pope
+" Filenames: *.msg.[0-9]* (first line is "From ... # This line is ignored.")
+" Last Change: 2010 May 21
+
+if exists("b:current_syntax")
+ finish
+endif
+
+runtime! syntax/mail.vim
+syn case match
+
+syn match gitsendemailComment "\%^From.*#.*"
+syn match gitsendemailComment "^GIT:.*"
+
+hi def link gitsendemailComment Comment
+
+let b:current_syntax = "gitsendemail"