7
|
1 " Vim syntax file
|
|
2 " Language: Rich Text Format
|
|
3 " "*.rtf" files
|
|
4 "
|
|
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/
|
|
9 "
|
|
10 " Maintainer: Dominique Stéphan (dominique@mggen.com)
|
|
11 " URL: http://www.mggen.com/vim/syntax/rtf.zip
|
|
12 " Last change: 2001 Mai 02
|
|
13
|
|
14 " TODO: render underline, italic, bold
|
|
15
|
|
16 " For version 5.x: Clear all syntax items
|
|
17 " For version 6.x: Quit when a syntax file was already loaded
|
|
18 if version < 600
|
|
19 syntax clear
|
|
20 elseif exists("b:current_syntax")
|
|
21 finish
|
|
22 endif
|
|
23
|
|
24 " case on (all controls must be lower case)
|
|
25 syn case match
|
|
26
|
|
27 " Control Words
|
|
28 syn match rtfControlWord "\\[a-z]\+[\-]\=[0-9]*"
|
|
29
|
|
30 " New Control Words (not in the 1987 specifications)
|
|
31 syn match rtfNewControlWord "\\\*\\[a-z]\+[\-]\=[0-9]*"
|
|
32
|
|
33 " Control Symbol : any \ plus a non alpha symbol, *, \, { and } and '
|
|
34 syn match rtfControlSymbol "\\[^a-zA-Z\*\{\}\\']"
|
|
35
|
|
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]"
|
|
43 " Unicode
|
|
44 syn match rtfUnicodeCharacter "\\u[0-9][0-9]*"
|
|
45
|
|
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]*"
|
|
50
|
|
51 " Some stuff for help files
|
|
52 syn match rtfFootNote "[#$K+]{\\footnote.*}" contains=rtfControlWord,rtfNewControlWord
|
|
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_rtf_syntax_inits")
|
|
58 if version < 508
|
|
59 let did_rtf_syntax_inits = 1
|
|
60 command -nargs=+ HiLink hi link <args>
|
|
61 else
|
|
62 command -nargs=+ HiLink hi def link <args>
|
|
63 endif
|
|
64
|
|
65
|
|
66 HiLink rtfControlWord Statement
|
|
67 HiLink rtfNewControlWord Special
|
|
68 HiLink rtfControlSymbol Constant
|
|
69 HiLink rtfCharacter Character
|
|
70 HiLink rtfUnicodeCharacter SpecialChar
|
|
71 HiLink rtfFootNote Comment
|
|
72
|
|
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
|
|
77
|
|
78 HiLink rtfRed rtfRed
|
|
79 HiLink rtfGreen rtfGreen
|
|
80 HiLink rtfBlue rtfBlue
|
|
81
|
|
82 delcommand HiLink
|
|
83 endif
|
|
84
|
|
85
|
|
86 let b:current_syntax = "rtf"
|
|
87
|
|
88 " vim:ts=8
|