blob: f4a90c62caecdec5f8c6595068ea8d4b0cf6fc18 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: RCS file
3" Maintainer: Dmitry Vasiliev <dima@hlabs.spb.ru>
4" URL: http://www.hlabs.spb.ru/vim/rcs.vim
5" Last Change: $Date$
6" Filenames: *,v
7" $Revision$
8"
9" Options:
10" rcs_folding = 1 For folding strings
11
12" For version 5.x: Clear all syntax items.
13" For version 6.x: Quit when a syntax file was already loaded.
14if version < 600
15 syntax clear
16elseif exists("b:current_syntax")
17 finish
18endif
19
20" RCS file must end with a newline.
21syn match rcsEOFError ".\%$" containedin=ALL
22
23" Keywords.
24syn keyword rcsKeyword head branch access symbols locks strict
25syn keyword rcsKeyword comment expand date author state branches
26syn keyword rcsKeyword next desc log
27syn keyword rcsKeyword text nextgroup=rcsTextStr skipwhite skipempty
28
29" Revision numbers and dates.
30syn match rcsNumber "\<[0-9.]\+\>" display
31
32" Strings.
33if exists("rcs_folding") && has("folding")
34 " Folded strings.
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
37else
38 syn region rcsString matchgroup=rcsString start="@" end="@" skip="@@" contains=rcsSpecial
39 syn region rcsTextStr matchgroup=rcsTextStr start="@" end="@" skip="@@" contained contains=rcsSpecial,rcsDiffLines
40endif
41syn match rcsSpecial "@@" contained
42syn match rcsDiffLines "[da]\d\+ \d\+$" contained
43
44" Synchronization.
45syn sync clear
46if exists("rcs_folding") && has("folding")
47 syn sync fromstart
48else
49 " We have incorrect folding if following sync patterns is turned on.
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
52endif
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.
57if 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
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
72
73 delcommand HiLink
74endif
75
76let b:current_syntax = "rcs"