1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
|
" Vim syntax file
" Language: R Help File
" Maintainer: Johannes Ranke <jranke@uni-bremen.de>
" Last Change: 2010 Apr 22
" Version: 0.7.3
" SVN: $Id: rhelp.vim 88 2010-04-22 19:37:09Z ranke $
" Remarks: - Now includes R syntax highlighting in the appropriate
" sections if an r.vim file is in the same directory or in the
" default debian location.
" - There is no Latex markup in equations
" - Thanks to Will Gray for finding and fixing a bug
" - No support for \if, \ifelse and \out as I don't understand
" them and have no examples at hand (help welcome).
" - No support for \var tag within quoted string (dito)
" Version Clears: {{{1
" For version 5.x: Clear all syntax items
" For version 6.x and 7.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
syn case match
" R help identifiers {{{
syn region rhelpIdentifier matchgroup=rhelpSection start="\\name{" end="}"
syn region rhelpIdentifier matchgroup=rhelpSection start="\\alias{" end="}"
syn region rhelpIdentifier matchgroup=rhelpSection start="\\pkg{" end="}"
syn region rhelpIdentifier matchgroup=rhelpSection start="\\item{" end="}" contained contains=rhelpDots
syn region rhelpIdentifier matchgroup=rhelpSection start="\\method{" end=/}/ contained
" Highlighting of R code using an existing r.vim syntax file if available {{{1
syn include @R syntax/r.vim
syn match rhelpDots "\\dots" containedin=@R
syn region rhelpRcode matchgroup=Delimiter start="\\examples{" matchgroup=Delimiter transparent end=/}/ contains=@R,rhelpSection
syn region rhelpRcode matchgroup=Delimiter start="\\usage{" matchgroup=Delimiter transparent end=/}/ contains=@R,rhelpIdentifier,rhelpS4method
syn region rhelpRcode matchgroup=Delimiter start="\\synopsis{" matchgroup=Delimiter transparent end=/}/ contains=@R
syn region rhelpRcode matchgroup=Delimiter start="\\special{" matchgroup=Delimiter transparent end=/}/ contains=@R contained
syn region rhelpRcode matchgroup=Delimiter start="\\code{" matchgroup=Delimiter transparent end=/}/ contains=@R,rhelpLink contained
syn region rhelpS4method matchgroup=Delimiter start="\\S4method{.*}(" matchgroup=Delimiter transparent end=/)/ contains=@R,rhelpDots contained
syn region rhelpSexpr matchgroup=Delimiter start="\\Sexpr{" matchgroup=Delimiter transparent end=/}/ contains=@R
" Strings {{{1
syn region rhelpString start=/"/ end=/"/
" Special characters ( \$ \& \% \# \{ \} \_) {{{1
syn match rhelpSpecialChar "\\[$&%#{}_]"
" Special Delimiters {{{1
syn match rhelpDelimiter "\\cr"
syn match rhelpDelimiter "\\tab "
" Keywords {{{1
syn match rhelpKeyword "\\R"
syn match rhelpKeyword "\\ldots"
syn match rhelpKeyword "--"
syn match rhelpKeyword "---"
syn match rhelpKeyword "<"
syn match rhelpKeyword ">"
syn match rhelpKeyword "\\ge"
syn match rhelpKeyword "\\le"
syn match rhelpKeyword "\\alpha"
syn match rhelpKeyword "\\beta"
syn match rhelpKeyword "\\gamma"
syn match rhelpKeyword "\\delta"
syn match rhelpKeyword "\\epsilon"
syn match rhelpKeyword "\\zeta"
syn match rhelpKeyword "\\eta"
syn match rhelpKeyword "\\theta"
syn match rhelpKeyword "\\iota"
syn match rhelpKeyword "\\kappa"
syn match rhelpKeyword "\\lambda"
syn match rhelpKeyword "\\mu"
syn match rhelpKeyword "\\nu"
syn match rhelpKeyword "\\xi"
syn match rhelpKeyword "\\omicron"
syn match rhelpKeyword "\\pi"
syn match rhelpKeyword "\\rho"
syn match rhelpKeyword "\\sigma"
syn match rhelpKeyword "\\tau"
syn match rhelpKeyword "\\upsilon"
syn match rhelpKeyword "\\phi"
syn match rhelpKeyword "\\chi"
syn match rhelpKeyword "\\psi"
syn match rhelpKeyword "\\omega"
syn match rhelpKeyword "\\Alpha"
syn match rhelpKeyword "\\Beta"
syn match rhelpKeyword "\\Gamma"
syn match rhelpKeyword "\\Delta"
syn match rhelpKeyword "\\Epsilon"
syn match rhelpKeyword "\\Zeta"
syn match rhelpKeyword "\\Eta"
syn match rhelpKeyword "\\Theta"
syn match rhelpKeyword "\\Iota"
syn match rhelpKeyword "\\Kappa"
syn match rhelpKeyword "\\Lambda"
syn match rhelpKeyword "\\Mu"
syn match rhelpKeyword "\\Nu"
syn match rhelpKeyword "\\Xi"
syn match rhelpKeyword "\\Omicron"
syn match rhelpKeyword "\\Pi"
syn match rhelpKeyword "\\Rho"
syn match rhelpKeyword "\\Sigma"
syn match rhelpKeyword "\\Tau"
syn match rhelpKeyword "\\Upsilon"
syn match rhelpKeyword "\\Phi"
syn match rhelpKeyword "\\Chi"
syn match rhelpKeyword "\\Psi"
syn match rhelpKeyword "\\Omega"
" Links {{{1
syn region rhelpLink matchgroup=rhelpSection start="\\link{" end="}" contained keepend
syn region rhelpLink matchgroup=rhelpSection start="\\link\[.\{-}\]{" end="}" contained keepend
syn region rhelpLink matchgroup=rhelpSection start="\\linkS4class{" end="}" contained keepend
" Type Styles {{{1
syn match rhelpType "\\emph\>"
syn match rhelpType "\\strong\>"
syn match rhelpType "\\bold\>"
syn match rhelpType "\\sQuote\>"
syn match rhelpType "\\dQuote\>"
syn match rhelpType "\\preformatted\>"
syn match rhelpType "\\kbd\>"
syn match rhelpType "\\samp\>"
syn match rhelpType "\\eqn\>"
syn match rhelpType "\\deqn\>"
syn match rhelpType "\\file\>"
syn match rhelpType "\\email\>"
syn match rhelpType "\\url\>"
syn match rhelpType "\\var\>"
syn match rhelpType "\\env\>"
syn match rhelpType "\\option\>"
syn match rhelpType "\\command\>"
syn match rhelpType "\\dfn\>"
syn match rhelpType "\\cite\>"
syn match rhelpType "\\acronym\>"
" rhelp sections {{{1
syn match rhelpSection "\\encoding\>"
syn match rhelpSection "\\title\>"
syn match rhelpSection "\\description\>"
syn match rhelpSection "\\concept\>"
syn match rhelpSection "\\arguments\>"
syn match rhelpSection "\\details\>"
syn match rhelpSection "\\value\>"
syn match rhelpSection "\\references\>"
syn match rhelpSection "\\note\>"
syn match rhelpSection "\\author\>"
syn match rhelpSection "\\seealso\>"
syn match rhelpSection "\\keyword\>"
syn match rhelpSection "\\docType\>"
syn match rhelpSection "\\format\>"
syn match rhelpSection "\\source\>"
syn match rhelpSection "\\itemize\>"
syn match rhelpSection "\\describe\>"
syn match rhelpSection "\\enumerate\>"
syn match rhelpSection "\\item "
syn match rhelpSection "\\item$"
syn match rhelpSection "\\tabular{[lcr]*}"
syn match rhelpSection "\\dontrun\>"
syn match rhelpSection "\\dontshow\>"
syn match rhelpSection "\\testonly\>"
syn match rhelpSection "\\donttest\>"
" Freely named Sections {{{1
syn region rhelpFreesec matchgroup=Delimiter start="\\section{" matchgroup=Delimiter transparent end=/}/
syn region rhelpFreesubsec matchgroup=Delimiter start="\\subsection{" matchgroup=Delimiter transparent end=/}/
" R help file comments {{{1
syn match rhelpComment /%.*$/ contained
" Error {{{1
syn region rhelpRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ transparent contains=ALLBUT,rhelpError,rhelpBraceError,rhelpCurlyError
syn region rhelpRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ transparent contains=ALLBUT,rhelpError,rhelpBraceError,rhelpParenError
syn region rhelpRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ transparent contains=ALLBUT,rhelpError,rhelpCurlyError,rhelpParenError
syn match rhelpError /[)\]}]/
syn match rhelpBraceError /[)}]/ contained
syn match rhelpCurlyError /[)\]]/ contained
syn match rhelpParenError /[\]}]/ contained
" Define the default highlighting {{{1
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_rhelp_syntax_inits")
if version < 508
let did_rhelp_syntax_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink rhelpIdentifier Identifier
HiLink rhelpString String
HiLink rhelpKeyword Keyword
HiLink rhelpDots Keyword
HiLink rhelpLink Underlined
HiLink rhelpType Type
HiLink rhelpSection PreCondit
HiLink rhelpError Error
HiLink rhelpBraceError Error
HiLink rhelpCurlyError Error
HiLink rhelpParenError Error
HiLink rhelpDelimiter Delimiter
HiLink rhelpComment Comment
HiLink rhelpRComment Comment
HiLink rhelpSpecialChar SpecialChar
delcommand HiLink
endif
let b:current_syntax = "rhelp"
" vim: foldmethod=marker:
|