codekingpro/portable-devtools
114k
1" Vim syntax file2" Language: git commit file3" Maintainer: Tim Pope <vimNOSPAM@tpope.org>4" Filenames: *.git/COMMIT_EDITMSG5" Last Change: 2023 Dec 286 7if exists("b:current_syntax")8 finish9endif10 11scriptencoding utf-812 13syn case match14syn sync minlines=5015syn sync linebreaks=116 17if has("spell")18 syn spell toplevel19endif20 21syn include @gitcommitDiff syntax/diff.vim22syn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|@@\@!\|[^[:alnum:]\ +-]\S\@!\)\@=/ fold contains=@gitcommitDiff23 24if get(g:, 'gitcommit_summary_length') < 025 syn match gitcommitSummary "^.*$" contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell26elseif get(g:, 'gitcommit_summary_length', 1) > 027 exe 'syn match gitcommitSummary "^.*\%<' . (get(g:, 'gitcommit_summary_length', 50) + 1) . 'v." contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell'28endif29syn match gitcommitOverflow ".*" contained contains=@Spell30syn match gitcommitBlank "^.\+" contained contains=@Spell31syn match gitcommitFirstLine "\%^.*" nextgroup=gitcommitBlank,gitcommitComment skipnl32 33let s:scissors = 034let s:l = search('^[#;@!$%^&|:] -\{24,\} >8 -\{24,\}$', 'cnW', '', 100)35if s:l == 036 let s:l = line('$')37elseif getline(s:l)[0] !=# getline(s:l - 1)[0]38 let s:scissors = 139endif40let s:comment = escape((matchstr(getline(s:l), '^[#;@!$%^&|:]\S\@!') . '#')[0], '^$.*[]~\"/')41 42if s:scissors43 let s:comment .= ' -\{24,\} >8 -\{24,\}$'44 exe 'syn region gitcommitComment start="^' . s:comment . '" end="\%$" contains=gitcommitDiff'45else46 exe 'syn match gitcommitComment "^' . s:comment . '.*"'47endif48exe 'syn match gitcommitTrailers "\n\@<=\n\%([[:alnum:]-]\+\s*:.*\|(cherry picked from commit .*\)\%(\n\s.*\|\n[[:alnum:]-]\+\s*:.*\|\n(cherry picked from commit .*\)*\%(\n\n*\%(' . s:comment . '\)\|\n*\%$\)\@="'49 50unlet s:l s:comment s:scissors51 52syn match gitcommitTrailerToken "^[[:alnum:]-]\+\s*:" contained containedin=gitcommitTrailers53 54syn match gitcommitHash "\<\x\{40,}\>" contains=@NoSpell display55syn match gitcommitOnBranch "\%(^. \)\@<=On branch" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite56syn match gitcommitOnBranch "\%(^. \)\@<=Your branch .\{-\} '" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite57syn match gitcommitBranch "[^ ']\+" contained58syn match gitcommitNoBranch "\%(^. \)\@<=Not currently on any branch." contained containedin=gitcommitComment59syn match gitcommitHeader "\%(^. \)\@<=\S.*[::]\%(\n^$\)\@!$" contained containedin=gitcommitComment60syn region gitcommitAuthor matchgroup=gitCommitHeader start=/\%(^. \)\@<=\%(Author\|Committer\|Date\):/ end=/$/ keepend oneline contained containedin=gitcommitComment transparent61syn match gitcommitHeader "\%(^. \)\@<=commit\%( \x\{40,\}$\)\@=" contained containedin=gitcommitComment nextgroup=gitcommitHash skipwhite62syn match gitcommitNoChanges "\%(^. \)\@<=No changes$" contained containedin=gitcommitComment63 64syn match gitcommitType "\%(^.\t\)\@<=[^[:punct:][:space:]][^/::]*[^[:punct:][:space:]][::]\ze "he=e-1 contained containedin=gitcommitComment nextgroup=gitcommitFile skipwhite65syn match gitcommitFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitArrow66syn match gitcommitArrow " -> " contained nextgroup=gitcommitFile67syn match gitcommitUntrackedFile "\%(^.\t\)\@<=[^::/]*\%(/.*\)\=$" contained containedin=gitcommitComment68 69syn region gitcommitUntracked start=/^\z(.\) Untracked files:$/ end=/^\z1\=$\|^\z1\@!/ contains=gitcommitHeader containedin=gitcommitComment containedin=gitcommitComment contained transparent fold70syn region gitcommitDiscarded start=/^\z(.\) Change\%(s not staged for commit\|d but not updated\):$/ end=/^\z1\=$\|^\z1\@!/ contains=gitcommitHeader,gitcommitDiscardedType containedin=gitcommitComment containedin=gitcommitComment contained transparent fold71syn region gitcommitSelected start=/^\z(.\) Changes to be committed:$/ end=/^\z1$\|^\z1\@!/ contains=gitcommitHeader,gitcommitSelectedType containedin=gitcommitComment containedin=gitcommitComment contained transparent fold72syn region gitcommitUnmerged start=/^\z(.\) Unmerged paths:$/ end=/^\z1\=$\|^\z1\@!/ contains=gitcommitHeader,gitcommitUnmergedType containedin=gitcommitComment containedin=gitcommitComment contained transparent fold73 74syn match gitcommitUntrackedFile "\%(^.\t\)\@<=.*" contained containedin=gitcommitUntracked75 76syn match gitcommitDiscardedType "\%(^.\t\)\@<=[^[:punct:][:space:]][^/::]*[^[:punct:][:space:]][::]\ze "he=e-1 contained nextgroup=gitcommitDiscardedFile skipwhite77syn match gitcommitSelectedType "\%(^.\t\)\@<=[^[:punct:][:space:]][^/::]*[^[:punct:][:space:]][::]\ze "he=e-1 contained nextgroup=gitcommitSelectedFile skipwhite78syn match gitcommitUnmergedType "\%(^.\t\)\@<=[^[:punct:][:space:]][^/::]*[^[:punct:][:space:]][::]\ze "he=e-1 contained nextgroup=gitcommitUnmergedFile skipwhite79syn match gitcommitDiscardedFile "\S.\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitDiscardedArrow80syn match gitcommitSelectedFile "\S.\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow81syn match gitcommitUnmergedFile "\S.\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitUnmergedArrow82syn match gitcommitDiscardedArrow " -> " contained nextgroup=gitcommitDiscardedFile83syn match gitcommitSelectedArrow " -> " contained nextgroup=gitcommitSelectedFile84syn match gitcommitUnmergedArrow " -> " contained nextgroup=gitcommitUnmergedFile85 86hi def link gitcommitSummary Keyword87hi def link gitcommitTrailerToken Label88hi def link gitcommitComment Comment89hi def link gitcommitHash Identifier90hi def link gitcommitOnBranch Comment91hi def link gitcommitBranch Special92hi def link gitcommitNoBranch gitCommitBranch93hi def link gitcommitDiscardedType gitcommitType94hi def link gitcommitSelectedType gitcommitType95hi def link gitcommitUnmergedType gitcommitType96hi def link gitcommitType Type97hi def link gitcommitNoChanges gitcommitHeader98hi def link gitcommitHeader PreProc99hi def link gitcommitUntrackedFile gitcommitFile100hi def link gitcommitDiscardedFile gitcommitFile101hi def link gitcommitSelectedFile gitcommitFile102hi def link gitcommitUnmergedFile gitcommitFile103hi def link gitcommitFile Constant104hi def link gitcommitDiscardedArrow gitcommitArrow105hi def link gitcommitSelectedArrow gitcommitArrow106hi def link gitcommitUnmergedArrow gitcommitArrow107hi def link gitcommitArrow gitcommitComment108"hi def link gitcommitOverflow Error109hi def link gitcommitBlank Error110 111let b:current_syntax = "gitcommit"112 