diff options
-rw-r--r-- | runtime/doc/change.txt | 6 | ||||
-rw-r--r-- | runtime/doc/eval.txt | 2 | ||||
-rw-r--r-- | runtime/doc/options.txt | 2 | ||||
-rw-r--r-- | runtime/ftplugin/r.vim | 3 | ||||
-rw-r--r-- | runtime/ftplugin/rhelp.vim | 3 | ||||
-rw-r--r-- | runtime/ftplugin/rmd.vim | 3 | ||||
-rw-r--r-- | runtime/ftplugin/rnoweb.vim | 3 | ||||
-rw-r--r-- | runtime/ftplugin/rrst.vim | 3 | ||||
-rw-r--r-- | runtime/indent/r.vim | 24 | ||||
-rw-r--r-- | runtime/indent/rhelp.vim | 3 | ||||
-rw-r--r-- | runtime/indent/rmd.vim | 3 | ||||
-rw-r--r-- | runtime/indent/rnoweb.vim | 3 | ||||
-rw-r--r-- | runtime/indent/rrst.vim | 3 | ||||
-rw-r--r-- | runtime/syntax/python.vim | 4 | ||||
-rw-r--r-- | runtime/syntax/r.vim | 62 | ||||
-rw-r--r-- | runtime/syntax/rhelp.vim | 246 | ||||
-rw-r--r-- | runtime/syntax/rmd.vim | 10 | ||||
-rw-r--r-- | runtime/syntax/rnoweb.vim | 33 | ||||
-rw-r--r-- | runtime/syntax/rrst.vim | 8 | ||||
-rw-r--r-- | runtime/syntax/vhdl.vim | 56 |
20 files changed, 265 insertions, 215 deletions
diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 4565cdf63e..2ccb9188a9 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -1,4 +1,4 @@ -*change.txt* For Vim version 7.4. Last change: 2016 Feb 10 +*change.txt* For Vim version 7.4. Last change: 2016 Mar 08 VIM REFERENCE MANUAL by Bram Moolenaar @@ -108,7 +108,9 @@ is an error when 'cpoptions' includes the 'E' flag. *J* J Join [count] lines, with a minimum of two lines. Remove the indent and insert up to two spaces (see - below). + below). Fails when on the last line of the buffer. + If [count] is too big it is reduce to the number of + lines available. *v_J* {Visual}J Join the highlighted lines, with a minimum of two diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 4122b27fd8..712a0d7e5a 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.4. Last change: 2016 Mar 07 +*eval.txt* For Vim version 7.4. Last change: 2016 Mar 08 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 887cff0707..76ecb57e34 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 7.4. Last change: 2016 Feb 24 +*options.txt* For Vim version 7.4. Last change: 2016 Mar 08 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/ftplugin/r.vim b/runtime/ftplugin/r.vim index 43b208b842..4ea3073922 100644 --- a/runtime/ftplugin/r.vim +++ b/runtime/ftplugin/r.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: R " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Sun Feb 23, 2014 04:07PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:38PM " Only do this when not yet done for this buffer if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/rhelp.vim b/runtime/ftplugin/rhelp.vim index 9b72fb42f9..fdac38f3e9 100644 --- a/runtime/ftplugin/rhelp.vim +++ b/runtime/ftplugin/rhelp.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: R help file " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Wed Jul 09, 2014 06:23PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:37PM " Only do this when not yet done for this buffer if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/rmd.vim b/runtime/ftplugin/rmd.vim index 55723ff396..ec64a07675 100644 --- a/runtime/ftplugin/rmd.vim +++ b/runtime/ftplugin/rmd.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: R help file " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Wed Jul 09, 2014 06:23PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:37PM " Original work by Alex Zvoleff (adjusted for rmd by Michel Kuhlmann) " Only do this when not yet done for this buffer diff --git a/runtime/ftplugin/rnoweb.vim b/runtime/ftplugin/rnoweb.vim index baf53d0108..e184399dcb 100644 --- a/runtime/ftplugin/rnoweb.vim +++ b/runtime/ftplugin/rnoweb.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: Rnoweb " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Wed Jul 09, 2014 06:23PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:37PM " Only do this when not yet done for this buffer if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/rrst.vim b/runtime/ftplugin/rrst.vim index 8140169e61..ecfd6e87a1 100644 --- a/runtime/ftplugin/rrst.vim +++ b/runtime/ftplugin/rrst.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: reStructuredText documentation format with R code " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Wed Jul 09, 2014 06:23PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:38PM " Original work by Alex Zvoleff " Only do this when not yet done for this buffer diff --git a/runtime/indent/r.vim b/runtime/indent/r.vim index 105f0cd7ad..01f3812ed2 100644 --- a/runtime/indent/r.vim +++ b/runtime/indent/r.vim @@ -1,7 +1,8 @@ " Vim indent file " Language: R " Author: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Thu Mar 26, 2015 05:36PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Thu Feb 18, 2016 06:32AM " Only load this indent file when no other was loaded. @@ -32,7 +33,7 @@ if ! exists("g:r_indent_ess_compatible") let g:r_indent_ess_compatible = 0 endif if ! exists("g:r_indent_op_pattern") - let g:r_indent_op_pattern = '\(+\|-\|\*\|/\|=\|\~\|%\)$' + let g:r_indent_op_pattern = '\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\)\s*$' endif function s:RDelete_quotes(line) @@ -265,7 +266,7 @@ function GetRIndent() return 0 endif - if cline =~ '^\s*{' + if cline =~ '^\s*{' && s:Get_paren_balance(cline, '{', '}') > 0 if g:r_indent_ess_compatible && line =~ ')$' let nlnum = lnum let nline = line @@ -283,7 +284,7 @@ function GetRIndent() endif " line is an incomplete command: - if line =~ '\<\(if\|while\|for\|function\)\s*()$' || line =~ '\<else$' || line =~ '<-$' + if line =~ '\<\(if\|while\|for\|function\)\s*()$' || line =~ '\<else$' || line =~ '<-$' || line =~ '->$' return indent(lnum) + &sw endif @@ -344,7 +345,7 @@ function GetRIndent() endif let post_block = 0 - if line =~ '}$' + if line =~ '}$' && s:Get_paren_balance(line, '{', '}') < 0 let lnum = s:Get_matching_brace(lnum, '{', '}', 0) let line = SanitizeRLine(getline(lnum)) if lnum > 0 && line =~ '^\s*{' @@ -359,14 +360,14 @@ function GetRIndent() let olnum = s:Get_prev_line(lnum) let oline = getline(olnum) if olnum > 0 - if line =~ g:r_indent_op_pattern - if oline =~ g:r_indent_op_pattern + if line =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 + if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 return indent(lnum) else return indent(lnum) + &sw endif else - if oline =~ g:r_indent_op_pattern + if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 return indent(lnum) - &sw endif endif @@ -471,7 +472,6 @@ function GetRIndent() endif let ind = indent(lnum) - let pind = indent(plnum) if g:r_indent_align_args == 0 && pb != 0 let ind += pb * &sw @@ -483,6 +483,12 @@ function GetRIndent() return ind endif + if plnum > 0 + let pind = indent(plnum) + else + let pind = 0 + endif + if ind == pind || (ind == (pind + &sw) && pline =~ '{$' && ppost_else == 0) return ind endif diff --git a/runtime/indent/rhelp.vim b/runtime/indent/rhelp.vim index 3b37128b2c..9dc2031cb6 100644 --- a/runtime/indent/rhelp.vim +++ b/runtime/indent/rhelp.vim @@ -1,7 +1,8 @@ " Vim indent file " Language: R Documentation (Help), *.Rd " Author: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Thu Oct 16, 2014 07:07AM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:38PM " Only load this indent file when no other was loaded. diff --git a/runtime/indent/rmd.vim b/runtime/indent/rmd.vim index 9a8a3cb719..88904405e8 100644 --- a/runtime/indent/rmd.vim +++ b/runtime/indent/rmd.vim @@ -1,7 +1,8 @@ " Vim indent file " Language: Rmd " Author: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Thu Jul 10, 2014 07:11PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:38PM " Only load this indent file when no other was loaded. diff --git a/runtime/indent/rnoweb.vim b/runtime/indent/rnoweb.vim index d0cad3d8d9..29fa5bc78f 100644 --- a/runtime/indent/rnoweb.vim +++ b/runtime/indent/rnoweb.vim @@ -1,7 +1,8 @@ " Vim indent file " Language: Rnoweb " Author: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Sun Mar 22, 2015 09:28AM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:38PM " Only load this indent file when no other was loaded. diff --git a/runtime/indent/rrst.vim b/runtime/indent/rrst.vim index 8bfa8344ce..f3ee53e7fb 100644 --- a/runtime/indent/rrst.vim +++ b/runtime/indent/rrst.vim @@ -1,7 +1,8 @@ " Vim indent file " Language: Rrst " Author: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Wed Jul 09, 2014 07:33PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:38PM " Only load this indent file when no other was loaded. diff --git a/runtime/syntax/python.vim b/runtime/syntax/python.vim index 78d35e4c15..2a0ea5de2b 100644 --- a/runtime/syntax/python.vim +++ b/runtime/syntax/python.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Python " Maintainer: Zvezdan Petkovic <zpetkovic@acm.org> -" Last Change: 2015 Sep 15 +" Last Change: 2016 Feb 20 " Credits: Neil Schemenauer <nas@python.ca> " Dmitry Vasiliev " @@ -199,6 +199,8 @@ if !exists("python_no_builtin_highlight") syn keyword pythonBuiltin ascii bytes exec " non-essential built-in functions; Python 2 only syn keyword pythonBuiltin apply buffer coerce intern + " avoid highlighting attributes as builtins + syn match pythonAttribute /\.\h\w*/hs=s+1 contains=ALLBUT,pythonBuiltin transparent endif " From the 'Python Library Reference' class hierarchy at the bottom. diff --git a/runtime/syntax/r.vim b/runtime/syntax/r.vim index e48b6686cb..d96bf96acb 100644 --- a/runtime/syntax/r.vim +++ b/runtime/syntax/r.vim @@ -5,17 +5,21 @@ " Tom Payne <tom@tompayne.org> " Contributor: Johannes Ranke <jranke@uni-bremen.de> " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Wed Oct 21, 2015 06:33AM +" Last Change: Thu Mar 10, 2016 12:26PM " Filenames: *.R *.r *.Rhistory *.Rt " " NOTE: The highlighting of R functions is defined in " runtime files created by a filetype plugin, if installed. " " CONFIGURATION: -" syntax folding can be turned on by +" Syntax folding can be turned on by " " let r_syntax_folding = 1 " +" ROxygen highlighting can be turned off by +" +" let r_hl_roxygen = 0 +" " Some lines of code were borrowed from Zhuojun Chen. if exists("b:current_syntax") @@ -24,9 +28,12 @@ endif setlocal iskeyword=@,48-57,_,. -if exists("g:r_syntax_folding") +if exists("g:r_syntax_folding") && g:r_syntax_folding setlocal foldmethod=syntax endif +if !exists("g:r_hl_roxygen") + let g:r_hl_roxygen = 1 +endif syn case match @@ -35,18 +42,20 @@ syn match rCommentTodo contained "\(BUG\|FIXME\|NOTE\|TODO\):" syn match rComment contains=@Spell,rCommentTodo,rOBlock "#.*" " Roxygen -syn region rOBlock start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\)\@!" contains=rOTitle,rOKeyword,rOExamples,@Spell keepend -syn region rOTitle start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\s*$\)\@=" contained contains=rOCommentKey -syn match rOCommentKey "#\{1,2}'" containedin=rOTitle contained - -syn region rOExamples start="^#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOKeyword - -syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|example\|include\|docType\)" -syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)" -syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)" -syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\|useDynLib\)" -syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)" -syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritParams\|field\)" +if g:r_hl_roxygen + syn region rOBlock start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\)\@!" contains=rOTitle,rOKeyword,rOExamples,@Spell keepend + syn region rOTitle start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\s*$\)\@=" contained contains=rOCommentKey + syn match rOCommentKey "#\{1,2}'" containedin=rOTitle contained + + syn region rOExamples start="^#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOKeyword + + syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|example\|include\|docType\)" + syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)" + syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)" + syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\|useDynLib\)" + syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)" + syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritParams\|field\)" +endif if &filetype == "rhelp" @@ -159,12 +168,13 @@ syn match rBraceError "[)}]" contained syn match rCurlyError "[)\]]" contained syn match rParenError "[\]}]" contained -" Source list of R functions produced by a filetype plugin (if installed) -if has("nvim") - " Nvim-R +if !exists("g:R_hi_fun") + let g:R_hi_fun = 1 +endif +if g:R_hi_fun + " Nvim-R: runtime R/functions.vim -else - " Vim-R-plugin + " Vim-R-plugin: runtime r-plugin/functions.vim endif @@ -235,11 +245,13 @@ hi def link rStatement Statement hi def link rString String hi def link rStrError Error hi def link rType Type -hi def link rOKeyword Title -hi def link rOBlock Comment -hi def link rOTitle Title -hi def link rOCommentKey Comment -hi def link rOExamples SpecialComment +if g:r_hl_roxygen + hi def link rOKeyword Title + hi def link rOBlock Comment + hi def link rOTitle Title + hi def link rOCommentKey Comment + hi def link rOExamples SpecialComment +endif let b:current_syntax="r" diff --git a/runtime/syntax/rhelp.vim b/runtime/syntax/rhelp.vim index 32c91add48..47c764e296 100644 --- a/runtime/syntax/rhelp.vim +++ b/runtime/syntax/rhelp.vim @@ -2,25 +2,21 @@ " Language: R Help File " Maintainer: Jakson Aquino <jalvesaq@gmail.com> " Former Maintainer: Johannes Ranke <jranke@uni-bremen.de> -" Last Change: Wed Jul 09, 2014 10:28PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Sat Feb 06, 2016 11:34AM " Remarks: - 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) +" - No support for \var tag within quoted string " 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") +if exists("b:current_syntax") finish endif +scriptencoding utf-8 setlocal iskeyword=@,48-57,_,. syn case match @@ -29,9 +25,11 @@ syn case match syn region rhelpIdentifier matchgroup=rhelpSection start="\\name{" end="}" syn region rhelpIdentifier matchgroup=rhelpSection start="\\alias{" end="}" syn region rhelpIdentifier matchgroup=rhelpSection start="\\pkg{" end="}" contains=rhelpLink +syn region rhelpIdentifier matchgroup=rhelpSection start="\\CRANpkg{" end="}" contains=rhelpLink syn region rhelpIdentifier matchgroup=rhelpSection start="\\method{" end="}" contained syn region rhelpIdentifier matchgroup=rhelpSection start="\\Rdversion{" end="}" + " Highlighting of R code using an existing r.vim syntax file if available {{{1 syn include @R syntax/r.vim @@ -69,76 +67,115 @@ syn match rhelpDelimiter "\\cr" syn match rhelpDelimiter "\\tab " " Keywords {{{1 -syn match rhelpKeyword "\\R" -syn match rhelpKeyword "\\ldots" +syn match rhelpKeyword "\\R\>" +syn match rhelpKeyword "\\ldots\>" +syn match rhelpKeyword "\\sspace\>" 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 extend -syn region rhelpLink matchgroup=rhelpSection start="\\link\[.\{-}\]{" end="}" contained keepend extend -syn region rhelpLink matchgroup=rhelpSection start="\\linkS4class{" end="}" contained keepend extend +" Condition Keywords {{{2 +syn match rhelpKeyword "\\if\>" +syn match rhelpKeyword "\\ifelse\>" +syn match rhelpKeyword "\\out\>" +" Examples of usage: +" \ifelse{latex}{\eqn{p = 5 + 6 - 7 \times 8}}{\eqn{p = 5 + 6 - 7 * 8}} +" \ifelse{latex}{\out{$\alpha$}}{\ifelse{html}{\out{α}}{alpha}} -" Verbatim like {{{1 -if v:version > 703 - syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment - syn region rhelpVerbatim matchgroup=rhelpType start="\\verb{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment +" Keywords and operators valid only if in math mode {{{2 +syn match rhelpMathOp "<" contained +syn match rhelpMathOp ">" contained +syn match rhelpMathOp "+" contained +syn match rhelpMathOp "-" contained +syn match rhelpMathOp "=" contained + +" Conceal function based on syntax/tex.vim {{{2 +if exists("g:tex_conceal") + let s:tex_conceal = g:tex_conceal else - syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@<!{.\{-}\\\@<!}' end="}" contains=rhelpSpecialChar,rhelpComment - syn region rhelpVerbatim matchgroup=rhelpType start="\\verb{" skip='\\\@<!{.\{-}\\\@<!}' end="}" contains=rhelpSpecialChar,rhelpComment + let s:tex_conceal = 'gm' endif +function s:HideSymbol(pat, cchar, hide) + if a:hide + exe "syn match rhelpMathSymb '" . a:pat . "' contained conceal cchar=" . a:cchar + else + exe "syn match rhelpMathSymb '" . a:pat . "' contained" + endif +endfunction + +" Math symbols {{{2 +if s:tex_conceal =~ 'm' + let s:hd = 1 +else + let s:hd = 0 +endif +call s:HideSymbol('\\infty\>', '∞', s:hd) +call s:HideSymbol('\\ge\>', '≥', s:hd) +call s:HideSymbol('\\le\>', '≤', s:hd) +call s:HideSymbol('\\prod\>', '∏', s:hd) +call s:HideSymbol('\\sum\>', '∑', s:hd) +syn match rhelpMathSymb "\\sqrt\>" contained + +" Greek letters {{{2 +if s:tex_conceal =~ 'g' + let s:hd = 1 +else + let s:hd = 0 +endif +call s:HideSymbol('\\alpha\>', 'α', s:hd) +call s:HideSymbol('\\beta\>', 'β', s:hd) +call s:HideSymbol('\\gamma\>', 'γ', s:hd) +call s:HideSymbol('\\delta\>', 'δ', s:hd) +call s:HideSymbol('\\epsilon\>', 'ϵ', s:hd) +call s:HideSymbol('\\zeta\>', 'ζ', s:hd) +call s:HideSymbol('\\eta\>', 'η', s:hd) +call s:HideSymbol('\\theta\>', 'θ', s:hd) +call s:HideSymbol('\\iota\>', 'ι', s:hd) +call s:HideSymbol('\\kappa\>', 'κ', s:hd) +call s:HideSymbol('\\lambda\>', 'λ', s:hd) +call s:HideSymbol('\\mu\>', 'μ', s:hd) +call s:HideSymbol('\\nu\>', 'ν', s:hd) +call s:HideSymbol('\\xi\>', 'ξ', s:hd) +call s:HideSymbol('\\pi\>', 'π', s:hd) +call s:HideSymbol('\\rho\>', 'ρ', s:hd) +call s:HideSymbol('\\sigma\>', 'σ', s:hd) +call s:HideSymbol('\\tau\>', 'τ', s:hd) +call s:HideSymbol('\\upsilon\>', 'υ', s:hd) +call s:HideSymbol('\\phi\>', 'ϕ', s:hd) +call s:HideSymbol('\\chi\>', 'χ', s:hd) +call s:HideSymbol('\\psi\>', 'ψ', s:hd) +call s:HideSymbol('\\omega\>', 'ω', s:hd) +call s:HideSymbol('\\Gamma\>', 'Γ', s:hd) +call s:HideSymbol('\\Delta\>', 'Δ', s:hd) +call s:HideSymbol('\\Theta\>', 'Θ', s:hd) +call s:HideSymbol('\\Lambda\>', 'Λ', s:hd) +call s:HideSymbol('\\Xi\>', 'Ξ', s:hd) +call s:HideSymbol('\\Pi\>', 'Π', s:hd) +call s:HideSymbol('\\Sigma\>', 'Σ', s:hd) +call s:HideSymbol('\\Upsilon\>', 'Υ', s:hd) +call s:HideSymbol('\\Phi\>', 'Φ', s:hd) +call s:HideSymbol('\\Psi\>', 'Ψ', s:hd) +call s:HideSymbol('\\Omega\>', 'Ω', s:hd) +delfunction s:HideSymbol +" Note: The letters 'omicron', 'Alpha', 'Beta', 'Epsilon', 'Zeta', 'Eta', +" 'Iota', 'Kappa', 'Mu', 'Nu', 'Omicron', 'Rho', 'Tau' and 'Chi' are listed +" at src/library/tools/R/Rd2txt.R because they are valid in HTML, although +" they do not make valid LaTeX code (e.g. Α versus \Alpha). + +" Links {{{1 +syn region rhelpLink matchgroup=rhelpType start="\\link{" end="}" contained keepend extend +syn region rhelpLink matchgroup=rhelpType start="\\link\[.\{-}\]{" end="}" contained keepend extend +syn region rhelpLink matchgroup=rhelpType start="\\linkS4class{" end="}" contained keepend extend +syn region rhelpLink matchgroup=rhelpType start="\\url{" end="}" contained keepend extend +syn region rhelpLink matchgroup=rhelpType start="\\href{" end="}" contained keepend extend +syn region rhelpLink matchgroup=rhelpType start="\\figure{" end="}" contained keepend extend + +" Verbatim like {{{1 +syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment +syn region rhelpVerbatim matchgroup=rhelpType start="\\verb{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment + +" Equation {{{1 +syn region rhelpEquation matchgroup=rhelpType start="\\eqn{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpMathSymb,rhelpMathOp,rhelpRegion contained keepend extend +syn region rhelpEquation matchgroup=rhelpType start="\\deqn{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpMathSymb,rhelpMathOp,rhelpRegion contained keepend extend " Type Styles {{{1 syn match rhelpType "\\emph\>" @@ -148,12 +185,9 @@ syn match rhelpType "\\sQuote\>" syn match rhelpType "\\dQuote\>" syn match rhelpType "\\preformatted\>" syn match rhelpType "\\kbd\>" -syn match rhelpType "\\eqn\>" -syn match rhelpType "\\deqn\>" syn match rhelpType "\\file\>" syn match rhelpType "\\email\>" -syn match rhelpType "\\url\>" -syn match rhelpType "\\href\>" +syn match rhelpType "\\enc\>" syn match rhelpType "\\var\>" syn match rhelpType "\\env\>" syn match rhelpType "\\option\>" @@ -163,6 +197,7 @@ syn match rhelpType "\\renewcommand\>" syn match rhelpType "\\dfn\>" syn match rhelpType "\\cite\>" syn match rhelpType "\\acronym\>" +syn match rhelpType "\\doi\>" " rhelp sections {{{1 syn match rhelpSection "\\encoding\>" @@ -202,9 +237,9 @@ syn match rhelpDelimiter "{\|\[\|(\|)\|\]\|}" syn match rhelpComment /%.*$/ " Error {{{1 -syn region rhelpRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim -syn region rhelpRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim -syn region rhelpRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim +syn region rhelpRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim,rhelpEquation +syn region rhelpRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim,rhelpEquation +syn region rhelpRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim,rhelpEquation syn match rhelpError /[)\]}]/ syn match rhelpBraceError /[)}]/ contained syn match rhelpCurlyError /[)\]]/ contained @@ -213,36 +248,27 @@ syn match rhelpParenError /[\]}]/ contained syntax sync match rhelpSyncRcode grouphere rhelpRcode "\\examples{" " 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 rhelpVerbatim String - HiLink rhelpDelimiter Delimiter - HiLink rhelpIdentifier Identifier - HiLink rhelpString String - HiLink rhelpCodeSpecial Special - 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 rhelpPreProc PreProc - HiLink rhelpDelimiter Delimiter - HiLink rhelpComment Comment - HiLink rhelpRComment Comment - HiLink rhelpSpecialChar SpecialChar - delcommand HiLink -endif +hi def link rhelpVerbatim String +hi def link rhelpDelimiter Delimiter +hi def link rhelpIdentifier Identifier +hi def link rhelpString String +hi def link rhelpCodeSpecial Special +hi def link rhelpKeyword Keyword +hi def link rhelpDots Keyword +hi def link rhelpLink Underlined +hi def link rhelpType Type +hi def link rhelpSection PreCondit +hi def link rhelpError Error +hi def link rhelpBraceError Error +hi def link rhelpCurlyError Error +hi def link rhelpParenError Error +hi def link rhelpPreProc PreProc +hi def link rhelpDelimiter Delimiter +hi def link rhelpComment Comment +hi def link rhelpRComment Comment +hi def link rhelpSpecialChar SpecialChar +hi def link rhelpMathSymb Special +hi def link rhelpMathOp Operator let b:current_syntax = "rhelp" diff --git a/runtime/syntax/rmd.vim b/runtime/syntax/rmd.vim index 6f1b847453..4cde7441d3 100644 --- a/runtime/syntax/rmd.vim +++ b/runtime/syntax/rmd.vim @@ -1,15 +1,13 @@ " markdown Text with R statements " Language: markdown with R code chunks -" Last Change: Wed Jul 09, 2014 10:29PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Sat Feb 06, 2016 06:45AM " " CONFIGURATION: " To highlight chunk headers as R code, put in your vimrc: " let rmd_syn_hl_chunk = 1 -" for portability -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists("b:current_syntax") finish endif @@ -58,6 +56,8 @@ if rmdIsPandoc == 0 if exists("b:current_syntax") unlet b:current_syntax endif + " Extend cluster + syn cluster texMathZoneGroup add=rmdrInline " Inline syntax match rmdLaTeXInlDelim "\$" syntax match rmdLaTeXInlDelim "\\\$" diff --git a/runtime/syntax/rnoweb.vim b/runtime/syntax/rnoweb.vim index 7d42395b5c..665acc53e2 100644 --- a/runtime/syntax/rnoweb.vim +++ b/runtime/syntax/rnoweb.vim @@ -1,20 +1,14 @@ " Vim syntax file " Language: R noweb Files " Maintainer: Johannes Ranke <jranke@uni-bremen.de> -" Last Change: 2009 May 05 -" Version: 0.9 -" SVN: $Id: rnoweb.vim 84 2009-05-03 19:52:47Z ranke $ +" Last Change: Sat Feb 06, 2016 06:47AM +" Version: 0.9.1 " Remarks: - This file is inspired by the proposal of -" Fernando Henrique Ferraz Pereira da Rosa <feferraz@ime.usp.br> -" http://www.ime.usp.br/~feferraz/en/sweavevim.html +" Fernando Henrique Ferraz Pereira da Rosa <feferraz@ime.usp.br> +" http://www.ime.usp.br/~feferraz/en/sweavevim.html " -" 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") +if exists("b:current_syntax") finish endif @@ -26,21 +20,22 @@ unlet b:current_syntax syn cluster texMatchGroup add=@rnoweb syn cluster texMathMatchGroup add=rnowebSexpr +syn cluster texMathZoneGroup add=rnowebSexpr syn cluster texEnvGroup add=@rnoweb syn cluster texFoldGroup add=@rnoweb -syn cluster texDocGroup add=@rnoweb -syn cluster texPartGroup add=@rnoweb -syn cluster texChapterGroup add=@rnoweb -syn cluster texSectionGroup add=@rnoweb -syn cluster texSubSectionGroup add=@rnoweb -syn cluster texSubSubSectionGroup add=@rnoweb -syn cluster texParaGroup add=@rnoweb +syn cluster texDocGroup add=@rnoweb +syn cluster texPartGroup add=@rnoweb +syn cluster texChapterGroup add=@rnoweb +syn cluster texSectionGroup add=@rnoweb +syn cluster texSubSectionGroup add=@rnoweb +syn cluster texSubSubSectionGroup add=@rnoweb +syn cluster texParaGroup add=@rnoweb " Highlighting of R code using an existing r.vim syntax file if available {{{1 syn include @rnowebR syntax/r.vim syn region rnowebChunk matchgroup=rnowebDelimiter start="^<<.*>>=" matchgroup=rnowebDelimiter end="^@" contains=@rnowebR,rnowebChunkReference,rnowebChunk fold keepend syn match rnowebChunkReference "^<<.*>>$" contained -syn region rnowebSexpr matchgroup=Delimiter start="\\Sexpr{" matchgroup=Delimiter end="}" contains=@rnowebR +syn region rnowebSexpr matchgroup=Delimiter start="\\Sexpr{" matchgroup=Delimiter end="}" contains=@rnowebR contained " Sweave options command {{{1 syn region rnowebSweaveopts matchgroup=Delimiter start="\\SweaveOpts{" matchgroup=Delimiter end="}" diff --git a/runtime/syntax/rrst.vim b/runtime/syntax/rrst.vim index 4667b3a2c1..24d3844df0 100644 --- a/runtime/syntax/rrst.vim +++ b/runtime/syntax/rrst.vim @@ -1,16 +1,14 @@ " reStructured Text with R statements " Language: reST with R code chunks " Maintainer: Alex Zvoleff, azvoleff@mail.sdsu.edu -" Last Change: Wed Jul 09, 2014 10:29PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Sat Feb 06, 2016 06:45AM " " CONFIGURATION: " To highlight chunk headers as R code, put in your vimrc: " let rrst_syn_hl_chunk = 1 -" for portability -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/vhdl.vim b/runtime/syntax/vhdl.vim index 044ef83d17..32503823ee 100644 --- a/runtime/syntax/vhdl.vim +++ b/runtime/syntax/vhdl.vim @@ -54,37 +54,37 @@ syn match vhdlError "\<else\s\+if\>" " Types and type qualifiers " Predefined standard VHDL types -syn match vhdlType "bit[\']*" -syn match vhdlType "boolean[\']*" -syn match vhdlType "natural[\']*" -syn match vhdlType "positive[\']*" -syn match vhdlType "integer[\']*" -syn match vhdlType "real[\']*" -syn match vhdlType "time[\']*" - -syn match vhdlType "bit_vector[\']*" -syn match vhdlType "boolean_vector[\']*" -syn match vhdlType "integer_vector[\']*" -syn match vhdlType "real_vector[\']*" -syn match vhdlType "time_vector[\']*" - -syn match vhdlType "character[\']*" -syn match vhdlType "string[\']*" +syn match vhdlType "\<bit\>\'\=" +syn match vhdlType "\<boolean\>\'\=" +syn match vhdlType "\<natural\>\'\=" +syn match vhdlType "\<positive\>\'\=" +syn match vhdlType "\<integer\>\'\=" +syn match vhdlType "\<real\>\'\=" +syn match vhdlType "\<time\>\'\=" + +syn match vhdlType "\<bit_vector\>\'\=" +syn match vhdlType "\<boolean_vector\>\'\=" +syn match vhdlType "\<integer_vector\>\'\=" +syn match vhdlType "\<real_vector\>\'\=" +syn match vhdlType "\<time_vector\>\'\=" + +syn match vhdlType "\<character\>\'\=" +syn match vhdlType "\<string\>\'\=" "syn keyword vhdlType severity_level -syn match vhdlType "line[\']*" -syn match vhdlType "text[\']*" +syn keyword vhdlType line +syn keyword vhdlType text " Predefined standard IEEE VHDL types -syn match vhdlType "std_ulogic[\']*" -syn match vhdlType "std_logic[\']*" -syn match vhdlType "std_ulogic_vector[\']*" -syn match vhdlType "std_logic_vector[\']*" -syn match vhdlType "unresolved_signed[\']*" -syn match vhdlType "unresolved_unsigned[\']*" -syn match vhdlType "u_signed[\']*" -syn match vhdlType "u_unsigned[\']*" -syn match vhdlType "signed[\']*" -syn match vhdlType "unsigned[\']*" +syn match vhdlType "\<std_ulogic\>\'\=" +syn match vhdlType "\<std_logic\>\'\=" +syn match vhdlType "\<std_ulogic_vector\>\'\=" +syn match vhdlType "\<std_logic_vector\>\'\=" +syn match vhdlType "\<unresolved_signed\>\'\=" +syn match vhdlType "\<unresolved_unsigned\>\'\=" +syn match vhdlType "\<u_signed\>\'\=" +syn match vhdlType "\<u_unsigned\>\'\=" +syn match vhdlType "\<signed\>\'\=" +syn match vhdlType "\<unsigned\>\'\=" " array attributes |