Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: generic ChangeLog file |
| 3 | " Written By: Gediminas Paulauskas <menesis@delfi.lt> |
| 4 | " Maintainer: Corinna Vinschen <vinschen@redhat.com> |
| 5 | " Last Change: June 1, 2003 |
| 6 | |
| 7 | " For version 5.x: Clear all syntax items |
| 8 | " For version 6.x: Quit when a syntax file was already loaded |
| 9 | if version < 600 |
| 10 | syntax clear |
| 11 | elseif exists("b:current_syntax") |
| 12 | finish |
| 13 | endif |
| 14 | |
| 15 | syn case ignore |
| 16 | |
| 17 | if exists('b:changelog_spacing_errors') |
| 18 | let s:spacing_errors = b:changelog_spacing_errors |
| 19 | elseif exists('g:changelog_spacing_errors') |
| 20 | let s:spacing_errors = g:changelog_spacing_errors |
| 21 | else |
| 22 | let s:spacing_errors = 1 |
| 23 | endif |
| 24 | |
| 25 | if s:spacing_errors |
| 26 | syn match changelogError "^ \+" |
| 27 | endif |
| 28 | |
| 29 | syn match changelogText "^\s.*$" contains=changelogMail,changelogNumber,changelogMonth,changelogDay,changelogError |
| 30 | syn match changelogHeader "^\S.*$" contains=changelogNumber,changelogMonth,changelogDay,changelogMail |
| 31 | if version < 600 |
| 32 | syn region changelogFiles start="^\s\+[+*]\s" end=":\s" end="^$" contains=changelogBullet,changelogColon,changelogError keepend |
| 33 | syn region changelogFiles start="^\s\+[([]" end=":\s" end="^$" contains=changelogBullet,changelogColon,changelogError keepend |
| 34 | syn match changelogColon contained ":\s" |
| 35 | else |
Bram Moolenaar | a5fb28b | 2005-10-10 21:00:54 +0000 | [diff] [blame] | 36 | syn region changelogFiles start="^\s\+[+*]\s" end=":" end="^$" contains=changelogBullet,changelogColon,changelogFuncs,changelogError keepend |
| 37 | syn region changelogFiles start="^\s\+[([]" end=":" end="^$" contains=changelogBullet,changelogColon,changelogFuncs,changelogError keepend |
| 38 | syn match changelogFuncs contained "(.\{-})" extend |
| 39 | syn match changelogFuncs contained "\[.\{-}]" extend |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 40 | syn match changelogColon contained ":" |
| 41 | endif |
| 42 | syn match changelogBullet contained "^\s\+[+*]\s" contains=changelogError |
| 43 | syn match changelogMail contained "<[A-Za-z0-9\._:+-]\+@[A-Za-z0-9\._-]\+>" |
| 44 | syn keyword changelogMonth contained jan feb mar apr may jun jul aug sep oct nov dec |
| 45 | syn keyword changelogDay contained mon tue wed thu fri sat sun |
| 46 | syn match changelogNumber contained "[.-]*[0-9]\+" |
| 47 | |
| 48 | " Define the default highlighting. |
| 49 | " For version 5.7 and earlier: only when not done already |
| 50 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 51 | if version >= 508 || !exists("did_changelog_syntax_inits") |
| 52 | if version < 508 |
| 53 | let did_changelog_syntax_inits = 1 |
| 54 | command -nargs=+ HiLink hi link <args> |
| 55 | else |
| 56 | command -nargs=+ HiLink hi def link <args> |
| 57 | endif |
| 58 | |
| 59 | HiLink changelogText Normal |
| 60 | HiLink changelogBullet Type |
| 61 | HiLink changelogColon Type |
| 62 | HiLink changelogFiles Comment |
| 63 | if version >= 600 |
| 64 | HiLink changelogFuncs Comment |
| 65 | endif |
| 66 | HiLink changelogHeader Statement |
| 67 | HiLink changelogMail Special |
| 68 | HiLink changelogNumber Number |
| 69 | HiLink changelogMonth Number |
| 70 | HiLink changelogDay Number |
| 71 | HiLink changelogError Folded |
| 72 | |
| 73 | delcommand HiLink |
| 74 | endif |
| 75 | |
| 76 | let b:current_syntax = "changelog" |
| 77 | |
| 78 | " vim: ts=8 |