Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
Bram Moolenaar | 3991dab | 2006-03-27 17:01:56 +0000 | [diff] [blame] | 2 | " Language: RCS file |
Bram Moolenaar | 5dc6252 | 2012-02-13 00:05:22 +0100 | [diff] [blame] | 3 | " Maintainer: Dmitry Vasiliev <dima at hlabs dot org> |
| 4 | " URL: https://github.com/hdima/vim-scripts/blob/master/syntax/rcs.vim |
| 5 | " Last Change: 2012-02-11 |
Bram Moolenaar | 3991dab | 2006-03-27 17:01:56 +0000 | [diff] [blame] | 6 | " Filenames: *,v |
Bram Moolenaar | 5dc6252 | 2012-02-13 00:05:22 +0100 | [diff] [blame] | 7 | " Version: 1.12 |
Bram Moolenaar | 3991dab | 2006-03-27 17:01:56 +0000 | [diff] [blame] | 8 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 9 | " Options: |
Bram Moolenaar | 3991dab | 2006-03-27 17:01:56 +0000 | [diff] [blame] | 10 | " rcs_folding = 1 For folding strings |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 11 | |
| 12 | " For version 5.x: Clear all syntax items. |
| 13 | " For version 6.x: Quit when a syntax file was already loaded. |
| 14 | if version < 600 |
| 15 | syntax clear |
| 16 | elseif exists("b:current_syntax") |
| 17 | finish |
| 18 | endif |
| 19 | |
| 20 | " RCS file must end with a newline. |
Bram Moolenaar | 3991dab | 2006-03-27 17:01:56 +0000 | [diff] [blame] | 21 | syn match rcsEOFError ".\%$" containedin=ALL |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 22 | |
| 23 | " Keywords. |
Bram Moolenaar | 3991dab | 2006-03-27 17:01:56 +0000 | [diff] [blame] | 24 | syn keyword rcsKeyword head branch access symbols locks strict |
| 25 | syn keyword rcsKeyword comment expand date author state branches |
| 26 | syn keyword rcsKeyword next desc log |
| 27 | syn keyword rcsKeyword text nextgroup=rcsTextStr skipwhite skipempty |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 28 | |
| 29 | " Revision numbers and dates. |
Bram Moolenaar | 3991dab | 2006-03-27 17:01:56 +0000 | [diff] [blame] | 30 | syn match rcsNumber "\<[0-9.]\+\>" display |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 31 | |
| 32 | " Strings. |
| 33 | if exists("rcs_folding") && has("folding") |
| 34 | " Folded strings. |
Bram Moolenaar | 3991dab | 2006-03-27 17:01:56 +0000 | [diff] [blame] | 35 | syn region rcsString matchgroup=rcsString start="@" end="@" skip="@@" fold contains=rcsSpecial |
| 36 | syn region rcsTextStr matchgroup=rcsTextStr start="@" end="@" skip="@@" fold contained contains=rcsSpecial,rcsDiffLines |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 37 | else |
Bram Moolenaar | 3991dab | 2006-03-27 17:01:56 +0000 | [diff] [blame] | 38 | syn region rcsString matchgroup=rcsString start="@" end="@" skip="@@" contains=rcsSpecial |
| 39 | syn region rcsTextStr matchgroup=rcsTextStr start="@" end="@" skip="@@" contained contains=rcsSpecial,rcsDiffLines |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 40 | endif |
Bram Moolenaar | 3991dab | 2006-03-27 17:01:56 +0000 | [diff] [blame] | 41 | syn match rcsSpecial "@@" contained |
| 42 | syn match rcsDiffLines "[da]\d\+ \d\+$" contained |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 43 | |
| 44 | " Synchronization. |
| 45 | syn sync clear |
| 46 | if exists("rcs_folding") && has("folding") |
| 47 | syn sync fromstart |
| 48 | else |
| 49 | " We have incorrect folding if following sync patterns is turned on. |
Bram Moolenaar | 3991dab | 2006-03-27 17:01:56 +0000 | [diff] [blame] | 50 | syn sync match rcsSync grouphere rcsString "[0-9.]\+\(\s\|\n\)\+log\(\s\|\n\)\+@"me=e-1 |
| 51 | syn sync match rcsSync grouphere rcsTextStr "@\(\s\|\n\)\+text\(\s\|\n\)\+@"me=e-1 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 52 | endif |
| 53 | |
| 54 | " Define the default highlighting. |
| 55 | " For version 5.7 and earlier: only when not done already. |
| 56 | " For version 5.8 and later: only when an item doesn't have highlighting yet. |
| 57 | if version >= 508 || !exists("did_rcs_syn_inits") |
| 58 | if version <= 508 |
| 59 | let did_rcs_syn_inits = 1 |
| 60 | command -nargs=+ HiLink hi link <args> |
| 61 | else |
| 62 | command -nargs=+ HiLink hi def link <args> |
| 63 | endif |
| 64 | |
Bram Moolenaar | 3991dab | 2006-03-27 17:01:56 +0000 | [diff] [blame] | 65 | HiLink rcsKeyword Keyword |
| 66 | HiLink rcsNumber Identifier |
| 67 | HiLink rcsString String |
| 68 | HiLink rcsTextStr String |
| 69 | HiLink rcsSpecial Special |
| 70 | HiLink rcsDiffLines Special |
| 71 | HiLink rcsEOFError Error |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 72 | |
| 73 | delcommand HiLink |
| 74 | endif |
| 75 | |
| 76 | let b:current_syntax = "rcs" |