2 " Language: Rich Text Format
5 " The Rich Text Format (RTF) Specification is a method of encoding formatted
6 " text and graphics for easy transfer between applications.
7 " .hlp (windows help files) use compiled rtf files
8 " rtf documentation at http://night.primate.wisc.edu/software/RTF/
10 " Maintainer: Dominique Stéphan (dominique@mggen.com)
11 " URL: http://www.mggen.com/vim/syntax/rtf.zip
12 " Last change: 2001 Mai 02
14 " TODO: render underline, italic, bold
16 " For version 5.x: Clear all syntax items
17 " For version 6.x: Quit when a syntax file was already loaded
20 elseif exists("b:current_syntax")
24 " case on (all controls must be lower case)
28 syn match rtfControlWord "\\[a-z]\+[\-]\=[0-9]*"
30 " New Control Words (not in the 1987 specifications)
31 syn match rtfNewControlWord "\\\*\\[a-z]\+[\-]\=[0-9]*"
33 " Control Symbol : any \ plus a non alpha symbol, *, \, { and } and '
34 syn match rtfControlSymbol "\\[^a-zA-Z\*\{\}\\']"
36 " { } and \ are special characters, to use them
37 " we add a backslash \
38 syn match rtfCharacter "\\\\"
39 syn match rtfCharacter "\\{"
40 syn match rtfCharacter "\\}"
41 " Escaped characters (for 8 bytes characters upper than 127)
42 syn match rtfCharacter "\\'[A-Za-z0-9][A-Za-z0-9]"
44 syn match rtfUnicodeCharacter "\\u[0-9][0-9]*"
46 " Color values, we will put this value in Red, Green or Blue
47 syn match rtfRed "\\red[0-9][0-9]*"
48 syn match rtfGreen "\\green[0-9][0-9]*"
49 syn match rtfBlue "\\blue[0-9][0-9]*"
51 " Some stuff for help files
52 syn match rtfFootNote "[#$K+]{\\footnote.*}" contains=rtfControlWord,rtfNewControlWord
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_rtf_syntax_inits")
59 let did_rtf_syntax_inits = 1
60 command -nargs=+ HiLink hi link <args>
62 command -nargs=+ HiLink hi def link <args>
66 HiLink rtfControlWord Statement
67 HiLink rtfNewControlWord Special
68 HiLink rtfControlSymbol Constant
69 HiLink rtfCharacter Character
70 HiLink rtfUnicodeCharacter SpecialChar
71 HiLink rtfFootNote Comment
73 " Define colors for the syntax file
74 hi rtfRed term=underline cterm=underline ctermfg=DarkRed gui=underline guifg=DarkRed
75 hi rtfGreen term=underline cterm=underline ctermfg=DarkGreen gui=underline guifg=DarkGreen
76 hi rtfBlue term=underline cterm=underline ctermfg=DarkBlue gui=underline guifg=DarkBlue
79 HiLink rtfGreen rtfGreen
80 HiLink rtfBlue rtfBlue
86 let b:current_syntax = "rtf"