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 |
Adrià Vilanova Martínez | b94c506 | 2024-10-26 11:27:57 +0200 | [diff] [blame] | 6 | " Last Change: 2024 Oct 26 |
Adrià Vilanova Martínez | 60b712e | 2024-01-30 01:49:53 +0100 | [diff] [blame] | 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 | |
Adrià Vilanova Martínez | b94c506 | 2024-10-26 11:27:57 +0200 | [diff] [blame] | 35 | " Sigils extracted from https://github.com/martinvonz/jj/blob/95283dd04f7047c48356de1addd3d59d35ec5bce/cli/src/diff_util.rs#L1542. |
| 36 | syn match jjdescriptionType "\%(^JJ:\s\+\)\@<=[CRMAD]\ze " contained containedin=jjdescriptionComment nextgroup=jjdescriptionFile skipwhite |
Adrià Vilanova Martínez | 60b712e | 2024-01-30 01:49:53 +0100 | [diff] [blame] | 37 | syn match jjdescriptionFile ".*" contained |
| 38 | |
Adrià Vilanova Martínez | b94c506 | 2024-10-26 11:27:57 +0200 | [diff] [blame] | 39 | syn region jjdescriptionSelected start=/^\z(^JJ: \)This commit contains the following changes:$/ end=/^\z1$\|^\z1\@!/ contains=jjdescriptionHeader,jjdescriptionSelectedType containedin=jjdescriptionComment contained transparent fold |
Adrià Vilanova Martínez | 60b712e | 2024-01-30 01:49:53 +0100 | [diff] [blame] | 40 | |
Adrià Vilanova Martínez | b94c506 | 2024-10-26 11:27:57 +0200 | [diff] [blame] | 41 | syn match jjdescriptionSelectedType "\%(^JJ:\s\+\)\@<=[CRMAD]\ze " contained nextgroup=jjdescriptionSelectedFile skipwhite |
Adrià Vilanova Martínez | 60b712e | 2024-01-30 01:49:53 +0100 | [diff] [blame] | 42 | syn match jjdescriptionSelectedFile ".*" contained |
| 43 | |
| 44 | hi def link jjdescriptionSummary Keyword |
| 45 | hi def link jjdescriptionComment Comment |
| 46 | hi def link jjdescriptionSelectedType jjdescriptionType |
| 47 | hi def link jjdescriptionType Type |
| 48 | hi def link jjdescriptionHeader PreProc |
| 49 | hi def link jjdescriptionSelectedFile jjdescriptionFile |
| 50 | hi def link jjdescriptionFile Constant |
| 51 | hi def link jjdescriptionBlank Error |
| 52 | |
| 53 | let b:current_syntax = "jjdescription" |