Adrià Vilanova Martínez | 60b712e | 2024-01-30 01:49:53 +0100 | [diff] [blame^] | 1 | " jjdescription syntax file |
| 2 | " Language: jjdescription file |
| 3 | " Maintainer: Adrià Vilanova <me@avm99963.com> |
| 4 | " Filenames: *.jjdescription |
| 5 | " Source: Based on syntax/gitcommit.vim |
| 6 | " Last Change: 2024 Jan 30 |
| 7 | |
| 8 | if exists("b:current_syntax") |
| 9 | finish |
| 10 | endif |
| 11 | |
| 12 | scriptencoding utf-8 |
| 13 | |
| 14 | syn case match |
| 15 | syn sync minlines=50 |
| 16 | syn sync linebreaks=1 |
| 17 | |
| 18 | if has("spell") |
| 19 | syn spell toplevel |
| 20 | endif |
| 21 | |
| 22 | if get(g:, 'jjdescription_summary_length') < 0 |
| 23 | syn match jjdescriptionSummary "^.*$" contained containedin=jjdescriptionFirstLine nextgroup=jjdescriptionOverflow contains=@Spell |
| 24 | elseif get(g:, 'jjdescription_summary_length', 1) > 0 |
| 25 | exe 'syn match jjdescriptionSummary "^.*\%<' . (get(g:, 'jjdescription_summary_length', 50) + 1) . 'v." contained containedin=jjdescriptionFirstLine nextgroup=jjdescriptionOverflow contains=@Spell' |
| 26 | endif |
| 27 | syn match jjdescriptionOverflow ".*" contained contains=@Spell |
| 28 | syn match jjdescriptionBlank "^.\+" contained contains=@Spell |
| 29 | syn match jjdescriptionFirstLine "\%^.*" nextgroup=jjdescriptionBlank,jjdescriptionComment skipnl |
| 30 | |
| 31 | syn match jjdescriptionComment "^JJ: .*" |
| 32 | |
| 33 | syn match jjdescriptionHeader "\%(^JJ: \)\@<=\S.*:\%(\n^$\)\@!$" contained containedin=jjdescriptionComment |
| 34 | |
| 35 | syn match jjdescriptionType "\%(^JJ:\s\+\)\@<=[MADR]\ze " contained containedin=jjdescriptionComment nextgroup=jjdescriptionFile skipwhite |
| 36 | syn match jjdescriptionFile ".*" contained |
| 37 | |
| 38 | syn region jjdescriptionSelected start=/^\z(^JJ: \)This commit contains the following changes:$/ end=/^\z1$\|^\z1\@!/ contains=jjdescriptionHeader,jjdescriptionSelectedType containedin=jjdescriptionComment containedin=jjdescriptionComment contained transparent fold |
| 39 | |
| 40 | syn match jjdescriptionSelectedType "\%(^JJ:\s\+\)\@<=[MADR]\ze " contained nextgroup=jjdescriptionSelectedFile skipwhite |
| 41 | syn match jjdescriptionSelectedFile ".*" contained |
| 42 | |
| 43 | hi def link jjdescriptionSummary Keyword |
| 44 | hi def link jjdescriptionComment Comment |
| 45 | hi def link jjdescriptionSelectedType jjdescriptionType |
| 46 | hi def link jjdescriptionType Type |
| 47 | hi def link jjdescriptionHeader PreProc |
| 48 | hi def link jjdescriptionSelectedFile jjdescriptionFile |
| 49 | hi def link jjdescriptionFile Constant |
| 50 | hi def link jjdescriptionBlank Error |
| 51 | |
| 52 | let b:current_syntax = "jjdescription" |