annotate runtime/syntax/gitcommit.vim @ 32292:91bb2a8cc866 v9.0.1478

patch 9.0.1478: filetypes for *.v files not detected properly Commit: https://github.com/vim/vim/commit/80406c26188219f3773b2e9c49160caeeb386ee2 Author: Turiiya <34311583+tobealive@users.noreply.github.com> Date: Sat Apr 22 21:38:47 2023 +0100 patch 9.0.1478: filetypes for *.v files not detected properly Problem: Filetypes for *.v files not detected properly. Solution: Use the file contents to detect the filetype. (Turiiya, closes #12281)
author Bram Moolenaar <Bram@vim.org>
date Sat, 22 Apr 2023 22:45:03 +0200
parents 3e661b0cf500
children 9828ad8d79bd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
1 " Vim syntax file
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
2 " Language: git commit file
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
4 " Filenames: *.git/COMMIT_EDITMSG
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
5 " Last Change: 2022 Jan 05
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
6
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
7 if exists("b:current_syntax")
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
8 finish
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
9 endif
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
10
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
11 scriptencoding utf-8
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
12
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
13 syn case match
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
14 syn sync minlines=50
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
15 syn sync linebreaks=1
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
16
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
17 if has("spell")
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
18 syn spell toplevel
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
19 endif
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
20
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
21 syn include @gitcommitDiff syntax/diff.vim
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
22 syn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|@@\@!\|[^[:alnum:]\ +-]\S\@!\)\@=/ fold contains=@gitcommitDiff
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
23
18818
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
24 syn match gitcommitSummary "^.*\%<51v." contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
25 syn match gitcommitOverflow ".*" contained contains=@Spell
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
26 syn match gitcommitBlank "^.\+" contained contains=@Spell
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
27 syn match gitcommitFirstLine "\%^.*" nextgroup=gitcommitBlank,gitcommitComment skipnl
18818
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
28
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
29 let s:scissors = 0
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
30 let s:l = search('^[#;@!$%^&|:] -\{24,\} >8 -\{24,\}$', 'cnW', '', 100)
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
31 if s:l == 0
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
32 let s:l = line('$')
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
33 elseif getline(s:l)[0] !=# getline(s:l - 1)[0]
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
34 let s:scissors = 1
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
35 endif
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
36 let s:comment = escape((matchstr(getline(s:l), '^[#;@!$%^&|:]\S\@!') . '#')[0], '^$.*[]~\"/')
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
37
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
38 if s:scissors
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
39 let s:comment .= ' -\{24,\} >8 -\{24,\}$'
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
40 exe 'syn region gitcommitComment start="^' . s:comment . '" end="\%$" contains=gitcommitDiff'
18818
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
41 else
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
42 exe 'syn match gitcommitComment "^' . s:comment . '.*"'
18818
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
43 endif
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
44 exe '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*\%$\)\@="'
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
45
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
46 unlet s:l s:comment s:scissors
18818
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
47
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
48 syn match gitcommitTrailerToken "^[[:alnum:]-]\+\s*:" contained containedin=gitcommitTrailers
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
49
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
50 syn match gitcommitHash "\<\x\{40,}\>" contains=@NoSpell display
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
51 syn match gitcommitOnBranch "\%(^. \)\@<=On branch" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
52 syn match gitcommitOnBranch "\%(^. \)\@<=Your branch .\{-\} '" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
3465
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
53 syn match gitcommitBranch "[^ ']\+" contained
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
54 syn match gitcommitNoBranch "\%(^. \)\@<=Not currently on any branch." contained containedin=gitcommitComment
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
55 syn match gitcommitHeader "\%(^. \)\@<=\S.*[::]\%(\n^$\)\@!$" contained containedin=gitcommitComment
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
56 syn region gitcommitAuthor matchgroup=gitCommitHeader start=/\%(^. \)\@<=\%(Author\|Committer\|Date\):/ end=/$/ keepend oneline contained containedin=gitcommitComment transparent
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
57 syn match gitcommitHeader "\%(^. \)\@<=commit\%( \x\{40,\}$\)\@=" contained containedin=gitcommitComment nextgroup=gitcommitHash skipwhite
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
58 syn match gitcommitNoChanges "\%(^. \)\@<=No changes$" contained containedin=gitcommitComment
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
59
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
60 syn match gitcommitType "\%(^.\t\)\@<=[^[:punct:][:space:]][^/::]*[^[:punct:][:space:]][::]\ze "he=e-1 contained containedin=gitcommitComment nextgroup=gitcommitFile skipwhite
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
61 syn match gitcommitFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitArrow
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
62 syn match gitcommitArrow " -> " contained nextgroup=gitcommitFile
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
63 syn match gitcommitUntrackedFile "\%(^.\t\)\@<=[^::/]*\%(/.*\)\=$" contained containedin=gitcommitComment
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
64
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
65 syn region gitcommitUntracked start=/^\z(.\) Untracked files:$/ end=/^\z1\=$\|^\z1\@!/ contains=gitcommitHeader containedin=gitcommitComment containedin=gitcommitComment contained transparent fold
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
66 syn 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 fold
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
67 syn region gitcommitSelected start=/^\z(.\) Changes to be committed:$/ end=/^\z1$\|^\z1\@!/ contains=gitcommitHeader,gitcommitSelectedType containedin=gitcommitComment containedin=gitcommitComment contained transparent fold
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
68 syn region gitcommitUnmerged start=/^\z(.\) Unmerged paths:$/ end=/^\z1\=$\|^\z1\@!/ contains=gitcommitHeader,gitcommitUnmergedType containedin=gitcommitComment containedin=gitcommitComment contained transparent fold
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
69
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
70 syn match gitcommitUntrackedFile "\%(^.\t\)\@<=.*" contained containedin=gitcommitUntracked
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4681
diff changeset
71
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
72 syn match gitcommitDiscardedType "\%(^.\t\)\@<=[^[:punct:][:space:]][^/::]*[^[:punct:][:space:]][::]\ze "he=e-1 contained nextgroup=gitcommitDiscardedFile skipwhite
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
73 syn match gitcommitSelectedType "\%(^.\t\)\@<=[^[:punct:][:space:]][^/::]*[^[:punct:][:space:]][::]\ze "he=e-1 contained nextgroup=gitcommitSelectedFile skipwhite
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
74 syn match gitcommitUnmergedType "\%(^.\t\)\@<=[^[:punct:][:space:]][^/::]*[^[:punct:][:space:]][::]\ze "he=e-1 contained nextgroup=gitcommitUnmergedFile skipwhite
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
75 syn match gitcommitDiscardedFile "\S.\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitDiscardedArrow
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
76 syn match gitcommitSelectedFile "\S.\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
77 syn match gitcommitUnmergedFile "\S.\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitUnmergedArrow
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
78 syn match gitcommitDiscardedArrow " -> " contained nextgroup=gitcommitDiscardedFile
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
79 syn match gitcommitSelectedArrow " -> " contained nextgroup=gitcommitSelectedFile
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
80 syn match gitcommitUnmergedArrow " -> " contained nextgroup=gitcommitUnmergedFile
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
81
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
82 hi def link gitcommitSummary Keyword
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
83 hi def link gitcommitTrailerToken Label
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
84 hi def link gitcommitComment Comment
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18818
diff changeset
85 hi def link gitcommitHash Identifier
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
86 hi def link gitcommitOnBranch Comment
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
87 hi def link gitcommitBranch Special
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
88 hi def link gitcommitNoBranch gitCommitBranch
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
89 hi def link gitcommitDiscardedType gitcommitType
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
90 hi def link gitcommitSelectedType gitcommitType
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
91 hi def link gitcommitUnmergedType gitcommitType
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
92 hi def link gitcommitType Type
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
93 hi def link gitcommitNoChanges gitcommitHeader
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
94 hi def link gitcommitHeader PreProc
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
95 hi def link gitcommitUntrackedFile gitcommitFile
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
96 hi def link gitcommitDiscardedFile gitcommitFile
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
97 hi def link gitcommitSelectedFile gitcommitFile
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
98 hi def link gitcommitUnmergedFile gitcommitFile
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
99 hi def link gitcommitFile Constant
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
100 hi def link gitcommitDiscardedArrow gitcommitArrow
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
101 hi def link gitcommitSelectedArrow gitcommitArrow
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
102 hi def link gitcommitUnmergedArrow gitcommitArrow
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
103 hi def link gitcommitArrow gitcommitComment
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
104 "hi def link gitcommitOverflow Error
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
105 hi def link gitcommitBlank Error
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
106
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
107 let b:current_syntax = "gitcommit"