vim-patch:11e3c5ba8203

Update runtime files
11e3c5ba82
This commit is contained in:
Jan Edmund Lazo 2021-05-02 12:45:09 -04:00
parent 7e36c9a2d3
commit 3bc852cabf
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15
18 changed files with 2347 additions and 2384 deletions

126
runtime/doc/ft_raku.txt Normal file
View File

@ -0,0 +1,126 @@
*vim-raku.txt* The Raku programming language filetype
*vim-raku*
Vim-raku provides syntax highlighting, indentation, and other support for
editing Raku programs.
1. Using Unicode in your Raku files |raku-unicode|
==============================================================================
1. Using Unicode in your Raku files *raku-unicode*
Defining new operators using Unicode symbols is a good way to make your
Raku program easy to read. See:
https://perl6advent.wordpress.com/2012/12/18/day-18-formulas-resistance-is-futile/
While Raku does define ASCII alternatives for some common operators (see
https://docs.raku.org/language/unicode_ascii), using the full range of
Unicode operators is highly desirable. Your operating system provides input
facilities, but using the features built in to Vim may be preferable.
The natural way to produce these symbols in Vim is to use digraph shortcuts
(:help |digraphs-use|). Many of them are defined; type `:digraphs` to get
the list. A convenient way to read the list of digraphs is to save them in a
file. From the shell: >
vim +'redir >/tmp/vim-digraphs-listing.txt' +digraphs +'redir END' +q
Some of them are available with standard Vim digraphs:
<< « /0 ∅ !< ≮ ~
>> » Ob ∘ !> ≯ ~
., … 00 ∞ (C ⊂ ~
(U ∩ -: ÷ )C ⊃ ~
)U (_ ⊆ >= ≥ ~
?= ≅ )_ ⊇ =< ≤ ~
(- ∈ ?= ≅ != ≠ ~
-) ∋ ?- ≃ ~
The Greek alphabet is available with '*' followed by a similar Latin symbol:
*p π ~
*t τ ~
*X × ~
Numbers, subscripts and superscripts are available with 's' and 'S':
0s ₀ 0S ⁰ ~
1s ₁ 1S ¹ ~
2s ₂ 9S ⁹ ~
But some don´t come defined by default. Those are digraph definitions you can
add in your ~/.vimrc file. >
exec 'digraph \\ '.char2nr('')
exec 'digraph \< '.char2nr('≼')
exec 'digraph \> '.char2nr('≽')
exec 'digraph (L '.char2nr('⊈')
exec 'digraph )L '.char2nr('⊉')
exec 'digraph (/ '.char2nr('⊄')
exec 'digraph )/ '.char2nr('⊅')
exec 'digraph )/ '.char2nr('⊅')
exec 'digraph U+ '.char2nr('⊎')
exec 'digraph 0- '.char2nr('⊖')
" Euler's constant
exec 'digraph ne '.char2nr('𝑒')
" Raku's atomic operations marker
exec 'digraph @@ '.char2nr('⚛')
Alternatively, you can write Insert mode abbreviations that convert ASCII-
based operators into their single-character Unicode equivalent. >
iabbrev <buffer> !(<) ⊄
iabbrev <buffer> !(<=) ⊈
iabbrev <buffer> !(>) ⊅
iabbrev <buffer> !(>=) ⊉
iabbrev <buffer> !(cont) ∌
iabbrev <buffer> !(elem) ∉
iabbrev <buffer> != ≠
iabbrev <buffer> (&) ∩
iabbrev <buffer> (+) ⊎
iabbrev <buffer> (-)
iabbrev <buffer> (.) ⊍
iabbrev <buffer> (<) ⊂
iabbrev <buffer> (<+) ≼
iabbrev <buffer> (<=) ⊆
iabbrev <buffer> (>) ⊃
iabbrev <buffer> (>+) ≽
iabbrev <buffer> (>=) ⊇
iabbrev <buffer> (\|)
iabbrev <buffer> (^) ⊖
iabbrev <buffer> (atomic) ⚛
iabbrev <buffer> (cont) ∋
iabbrev <buffer> (elem) ∈
iabbrev <buffer> * ×
iabbrev <buffer> **0 ⁰
iabbrev <buffer> **1 ¹
iabbrev <buffer> **2 ²
iabbrev <buffer> **3 ³
iabbrev <buffer> **4 ⁴
iabbrev <buffer> **5 ⁵
iabbrev <buffer> **6 ⁶
iabbrev <buffer> **7 ⁷
iabbrev <buffer> **8 ⁸
iabbrev <buffer> **9 ⁹
iabbrev <buffer> ... …
iabbrev <buffer> / ÷
iabbrev <buffer> << «
iabbrev <buffer> <<[=]<< «=«
iabbrev <buffer> <<[=]>> «=»
iabbrev <buffer> <= ≤
iabbrev <buffer> =~= ≅
iabbrev <buffer> >= ≥
iabbrev <buffer> >> »
iabbrev <buffer> >>[=]<< »=«
iabbrev <buffer> >>[=]>> »=»
iabbrev <buffer> Inf ∞
iabbrev <buffer> atomic-add-fetch ⚛+=
iabbrev <buffer> atomic-assign ⚛=
iabbrev <buffer> atomic-fetch ⚛
iabbrev <buffer> atomic-dec-fetch --⚛
iabbrev <buffer> atomic-fetch-dec ⚛--
iabbrev <buffer> atomic-fetch-inc ⚛++
iabbrev <buffer> atomic-inc-fetch ++⚛
iabbrev <buffer> atomic-sub-fetch ⚛−=
iabbrev <buffer> e 𝑒
iabbrev <buffer> o ∘
iabbrev <buffer> pi π
iabbrev <buffer> set() ∅
iabbrev <buffer> tau τ
<
vim:tw=78:ts=8:noet:ft=help:norl:

View File

@ -180,14 +180,14 @@ after it. That way you don't have this problem again.
The |:global| command can be combined with the |:move| command to move all the
lines before the first line, resulting in a reversed file. The command is: >
:global/^/m 0
:global/^/move 0
Abbreviated: >
:g/^/m 0
The "^" regular expression matches the beginning of the line (even if the line
is blank). The |:move| command moves the matching line to after the mythical
is blank). The |:move| command moves the matching line to after the imaginary
zeroth line, so the current matching line becomes the first line of the file.
As the |:global| command is not confused by the changing line numbering,
|:global| proceeds to match all remaining lines of the file and puts each as

View File

@ -115,12 +115,20 @@ if you are impatient.
FOUR KINDS OF NUMBERS
Numbers can be decimal, hexadecimal, octal or binary. A hexadecimal number
starts with "0x" or "0X". For example "0x1f" is decimal 31. An octal number
starts with a zero. "017" is decimal 15. A binary number starts with "0b" or
"0B". For example "0b101" is decimal 5. Careful: don't put a zero before a
decimal number, it will be interpreted as an octal number!
The ":echo" command always prints decimal numbers. Example: >
Numbers can be decimal, hexadecimal, octal or binary.
A hexadecimal number starts with "0x" or "0X". For example "0x1f" is decimal
31.
An octal number starts with "0o", "0O" or a zero and another digit. "0o17" is
decimal 15. Using just a zero prefix is not supported in Vim9 script.
A binary number starts with "0b" or "0B". For example "0b101" is decimal 5.
A decimal number is just digits. Careful: don't put a zero before a decimal
number, it will be interpreted as an octal number in legacy script!
The ":echo" command always prints decimal numbers. Example: >
:echo 0x7f 0o36
< 127 30 ~

View File

@ -1,77 +0,0 @@
" Vim filetype plugin file
" Language: Perl 6
" Maintainer: vim-perl <vim-perl@googlegroups.com>
" Homepage: https://github.com/vim-perl/vim-perl
" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
" Last Change: 2020 Apr 15
" Contributors: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
"
" Based on ftplugin/perl.vim by Dan Sharp <dwsharp at hotmail dot com>
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
" Make sure the continuation lines below do not cause problems in
" compatibility mode.
let s:save_cpo = &cpo
set cpo-=C
setlocal formatoptions-=t
setlocal formatoptions+=crqol
setlocal keywordprg=p6doc
setlocal comments=:#
setlocal commentstring=#%s
" Change the browse dialog on Win32 to show mainly Perl-related files
if has("gui_win32")
let b:browsefilter = "Perl Source Files (*.pl)\t*.pl\n" .
\ "Perl Modules (*.pm)\t*.pm\n" .
\ "Perl Documentation Files (*.pod)\t*.pod\n" .
\ "All Files (*.*)\t*.*\n"
endif
" Provided by Ned Konz <ned at bike-nomad dot com>
"---------------------------------------------
setlocal include=\\<\\(use\\\|require\\)\\>
setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.pm','')
setlocal define=[^A-Za-z_]
" The following line changes a global variable but is necessary to make
" gf and similar commands work. Thanks to Andrew Pimlott for pointing out
" the problem. If this causes a " problem for you, add an
" after/ftplugin/perl6.vim file that contains
" set isfname-=:
set isfname+=:
setlocal iskeyword=48-57,_,A-Z,a-z,:,-
" Set this once, globally.
if !exists("perlpath")
if executable("perl6")
try
if &shellxquote != '"'
let perlpath = system('perl6 -e "@*INC.join(q/,/).say"')
else
let perlpath = system("perl6 -e '@*INC.join(q/,/).say'")
endif
let perlpath = substitute(perlpath,',.$',',,','')
catch /E145:/
let perlpath = ".,,"
endtry
else
" If we can't call perl to get its path, just default to using the
" current directory and the directory of the current file.
let perlpath = ".,,"
endif
endif
let &l:path=perlpath
"---------------------------------------------
" Undo the stuff we changed.
let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isk<" .
\ " | unlet! b:browsefilter"
" Restore the saved compatibility options.
let &cpo = s:save_cpo
unlet s:save_cpo

View File

@ -2,7 +2,7 @@
" Language: R
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
" Last Change: Tue Apr 07, 2015 04:38PM
" Last Change: Sat Aug 15, 2020 11:37AM
" Only do this when not yet done for this buffer
if exists("b:did_ftplugin")
@ -20,7 +20,7 @@ setlocal formatoptions-=t
setlocal commentstring=#\ %s
setlocal comments=:#',:###,:##,:#
if has("gui_win32") && !exists("b:browsefilter")
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "R Source Files (*.R)\t*.R\n" .
\ "Files that include R (*.Rnw *.Rd *.Rmd *.Rrst)\t*.Rnw;*.Rd;*.Rmd;*.Rrst\n" .
\ "All Files (*.*)\t*.*\n"

127
runtime/ftplugin/raku.vim Normal file
View File

@ -0,0 +1,127 @@
" Vim filetype plugin file
" Language: Raku
" Maintainer: vim-perl <vim-perl@googlegroups.com>
" Homepage: https://github.com/Raku/vim-raku
" Bugs/requests: https://github.com/Raku/vim-raku/issues
" Last Change: 2021-04-16
" Contributors: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
"
" Based on ftplugin/perl.vim by Dan Sharp <dwsharp at hotmail dot com>
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
" Make sure the continuation lines below do not cause problems in
" compatibility mode.
let s:save_cpo = &cpo
set cpo-=C
setlocal formatoptions-=t
setlocal formatoptions+=crqol
setlocal keywordprg=p6doc
setlocal comments=:#\|,:#=,:#
setlocal commentstring=#%s
" Provided by Ned Konz <ned at bike-nomad dot com>
"---------------------------------------------
setlocal include=\\<\\(use\\\|require\\)\\>
setlocal includeexpr=substitute(v:fname,'::','/','g')
setlocal suffixesadd=.rakumod,.rakudoc,.pm6,.pm
setlocal define=[^A-Za-z_]
" The following line changes a global variable but is necessary to make
" gf and similar commands work. Thanks to Andrew Pimlott for pointing out
" the problem. If this causes a problem for you, add an
" after/ftplugin/raku.vim file that contains
" set isfname-=:
set isfname+=:
setlocal iskeyword=@,48-57,_,192-255,-
" Raku exposes its CompUnits through $*REPO, but mapping module names to
" compunit paths is nontrivial. Probably it's more convenient to rely on
" people using zef, which has a handy store of sources for modules it has
" installed.
func s:compareReverseFtime(a, b)
let atime = getftime(a:a)
let btime = getftime(a:b)
return atime > btime ? -1 : atime == btime ? 0 : 1
endfunc
let &l:path = "lib,."
if exists('$RAKULIB')
let &l:path = &l:path . "," . $RAKULIB
endif
let &l:path = &l:path . "," . join(
\ sort(glob("~/.zef/store/*/*/lib", 0, 1), "s:compareReverseFtime"),
\ ',')
" Convert ascii-based ops into their single-character unicode equivalent
if get(g:, 'raku_unicode_abbrevs', 0)
iabbrev <buffer> !(<)
iabbrev <buffer> !(<=)
iabbrev <buffer> !(>)
iabbrev <buffer> !(>=)
iabbrev <buffer> !(cont)
iabbrev <buffer> !(elem)
iabbrev <buffer> !=
iabbrev <buffer> (&)
iabbrev <buffer> (+)
iabbrev <buffer> (-)
iabbrev <buffer> (.)
iabbrev <buffer> (<)
iabbrev <buffer> (<+)
iabbrev <buffer> (<=)
iabbrev <buffer> (>)
iabbrev <buffer> (>+)
iabbrev <buffer> (>=)
iabbrev <buffer> (\|)
iabbrev <buffer> (^)
iabbrev <buffer> (atomic)
iabbrev <buffer> (cont)
iabbrev <buffer> (elem)
iabbrev <buffer> * ×
iabbrev <buffer> **0
iabbrev <buffer> **1 ¹
iabbrev <buffer> **2 ²
iabbrev <buffer> **3 ³
iabbrev <buffer> **4
iabbrev <buffer> **5
iabbrev <buffer> **6
iabbrev <buffer> **7
iabbrev <buffer> **8
iabbrev <buffer> **9
iabbrev <buffer> ... …
iabbrev <buffer> / ÷
iabbrev <buffer> << «
iabbrev <buffer> <<[=]<< «=«
iabbrev <buffer> <<[=]>> «=»
iabbrev <buffer> <=
iabbrev <buffer> =~=
iabbrev <buffer> >=
iabbrev <buffer> >> »
iabbrev <buffer> >>[=]<< »=«
iabbrev <buffer> >>[=]>> »=»
iabbrev <buffer> Inf
iabbrev <buffer> atomic-add-fetch+=
iabbrev <buffer> atomic-assign=
iabbrev <buffer> atomic-fetch
iabbrev <buffer> atomic-dec-fetch --
iabbrev <buffer> atomic-fetch-dec--
iabbrev <buffer> atomic-fetch-inc++
iabbrev <buffer> atomic-inc-fetch ++
iabbrev <buffer> atomic-sub-fetch ⚛−=
iabbrev <buffer> e 𝑒
iabbrev <buffer> o
iabbrev <buffer> pi π
iabbrev <buffer> set()
iabbrev <buffer> tau τ
endif
" Undo the stuff we changed.
let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isf< isk< kp< path<" .
\ " | unlet! b:browsefilter"
" Restore the saved compatibility options.
let &cpo = s:save_cpo
unlet s:save_cpo

View File

@ -2,7 +2,7 @@
" Language: R help file
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
" Last Change: Tue Apr 07, 2015 04:37PM
" Last Change: Sat Aug 15, 2020 12:01PM
" Only do this when not yet done for this buffer
if exists("b:did_ftplugin")
@ -17,7 +17,7 @@ set cpo&vim
setlocal iskeyword=@,48-57,_,.
if has("gui_win32") && !exists("b:browsefilter")
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" .
\ "All Files (*.*)\t*.*\n"
endif

View File

@ -2,7 +2,7 @@
" Language: R Markdown file
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
" Last Change: Sun Jul 22, 2018 06:51PM
" Last Change: Sat Aug 15, 2020 12:03PM
" Original work by Alex Zvoleff (adjusted from R help for rmd by Michel Kuhlmann)
" Only do this when not yet done for this buffer
@ -46,7 +46,7 @@ runtime ftplugin/pandoc.vim
" Don't load another plugin for this buffer
let b:did_ftplugin = 1
if has("gui_win32") && !exists("b:browsefilter")
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" .
\ "All Files (*.*)\t*.*\n"
endif

View File

@ -2,7 +2,7 @@
" Language: Rnoweb
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
" Last Change: Tue Apr 07, 2015 04:37PM
" Last Change: Sat Aug 15, 2020 12:02PM
" Only do this when not yet done for this buffer
if exists("b:did_ftplugin")
@ -24,7 +24,7 @@ setlocal iskeyword=@,48-57,_,.
setlocal suffixesadd=.bib,.tex
setlocal comments=b:%,b:#,b:##,b:###,b:#'
if has("gui_win32") && !exists("b:browsefilter")
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" .
\ "All Files (*.*)\t*.*\n"
endif

View File

@ -2,7 +2,7 @@
" Language: reStructuredText documentation format with R code
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
" Last Change: Wed Nov 01, 2017 10:47PM
" Last Change: Sat Aug 15, 2020 12:02PM
" Original work by Alex Zvoleff
" Only do this when not yet done for this buffer
@ -37,7 +37,7 @@ if !exists("g:rrst_dynamic_comments") || (exists("g:rrst_dynamic_comments") && g
setlocal formatexpr=FormatRrst()
endif
if has("gui_win32") && !exists("b:browsefilter")
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" .
\ "All Files (*.*)\t*.*\n"
endif

View File

@ -36,7 +36,7 @@ let b:did_indent = 1
" Is syntax highlighting active ?
let b:indent_use_syntax = has("syntax")
setlocal indentexpr=GetPerl6Indent()
setlocal indentexpr=GetRakuIndent()
" we reset it first because the Perl 5 indent file might have been loaded due
" to a .pl/pm file extension, and indent files don't clean up afterwards
@ -50,7 +50,7 @@ endif
let s:cpo_save = &cpo
set cpo-=C
function! GetPerl6Indent()
function! GetRakuIndent()
" Get the line to be indented
let cline = getline(v:lnum)
@ -60,11 +60,6 @@ function! GetPerl6Indent()
return 0
endif
" Don't reindent coments on first column
if cline =~ '^#'
return 0
endif
" Get current syntax item at the line's first char
let csynid = ''
if b:indent_use_syntax
@ -72,7 +67,7 @@ function! GetPerl6Indent()
endif
" Don't reindent POD and heredocs
if csynid =~ "^p6Pod"
if csynid =~ "^rakuPod"
return indent(v:lnum)
endif
@ -92,7 +87,7 @@ function! GetPerl6Indent()
let skippin = 2
while skippin
let synid = synIDattr(synID(lnum,1,0),"name")
if (synid =~ "^p6Pod" || synid =~ "p6Comment")
if (synid =~ "^rakuPod" || synid =~ "rakuComment")
let lnum = prevnonblank(lnum - 1)
if lnum == 0
return 0
@ -107,19 +102,19 @@ function! GetPerl6Indent()
endif
if line =~ '[<«\[{(]\s*\(#[^)}\]»>]*\)\=$'
let ind = ind + shiftwidth()
let ind = ind + &sw
endif
if cline =~ '^\s*[)}\]»>]'
let ind = ind - shiftwidth()
let ind = ind - &sw
endif
" Indent lines that begin with 'or' or 'and'
if cline =~ '^\s*\(or\|and\)\>'
if line !~ '^\s*\(or\|and\)\>'
let ind = ind + shiftwidth()
let ind = ind + &sw
endif
elseif line =~ '^\s*\(or\|and\)\>'
let ind = ind - shiftwidth()
let ind = ind - &sw
endif
return ind

View File

@ -2,7 +2,7 @@
" Language: Rmd
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
" Last Change: Sun Aug 19, 2018 09:14PM
" Last Change: Sun Mar 28, 2021 08:05PM
" Only load this indent file when no other was loaded.
@ -13,7 +13,7 @@ runtime indent/r.vim
let s:RIndent = function(substitute(&indentexpr, "()", "", ""))
let b:did_indent = 1
setlocal indentkeys=0{,0},:,!^F,o,O,e
setlocal indentkeys=0{,0},<:>,!^F,o,O,e
setlocal indentexpr=GetRmdIndent()
if exists("*GetRmdIndent")
@ -23,6 +23,21 @@ endif
let s:cpo_save = &cpo
set cpo&vim
" Simple Python indentation algorithm
function s:GetPyIndent()
let plnum = prevnonblank(v:lnum - 1)
let pline = getline(plnum)
let cline = getline(v:lnum)
if pline =~ '^s```\s*{\s*python '
return 0
elseif pline =~ ':$'
return indent(plnum) + &shiftwidth
elseif cline =~ 'else:$'
return indent(plnum) - &shiftwidth
endif
return indent(plnum)
endfunction
function s:GetMdIndent()
let pline = getline(v:lnum - 1)
let cline = getline(v:lnum)
@ -37,13 +52,14 @@ function s:GetMdIndent()
endfunction
function s:GetYamlIndent()
let pline = getline(v:lnum - 1)
let plnum = prevnonblank(v:lnum - 1)
let pline = getline(plnum)
if pline =~ ':\s*$'
return indent(v:lnum) + shiftwidth()
return indent(plnum) + shiftwidth()
elseif pline =~ '^\s*- '
return indent(v:lnum) + 2
endif
return indent(prevnonblank(v:lnum - 1))
return indent(plnum)
endfunction
function GetRmdIndent()
@ -52,9 +68,11 @@ function GetRmdIndent()
endif
if search('^[ \t]*```{r', "bncW") > search('^[ \t]*```$', "bncW")
return s:RIndent()
elseif v:lnum > 1 && search('^---$', "bnW") == 1 &&
\ (search('^---$', "nW") > v:lnum || search('^...$', "nW") > v:lnum)
elseif v:lnum > 1 && (search('^---$', "bnW") == 1 &&
\ (search('^---$', "nW") > v:lnum || search('^\.\.\.$', "nW") > v:lnum))
return s:GetYamlIndent()
elseif search('^[ \t]*```{python', "bncW") > search('^[ \t]*```$', "bncW")
return s:GetPyIndent()
else
return s:GetMdIndent()
endif

View File

@ -1,7 +1,7 @@
" Vim indent file
" Language: Vim script
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2021 Feb 18
" Last Change: 2021 Apr 18
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@ -71,7 +71,8 @@ function GetVimIndentIntern()
" End of heredoc: use indent of matching start line
let lnum = v:lnum - 1
while lnum > 0
if synIDattr(synID(lnum, 1, 1), "name") !~ 'vimLetHereDoc'
let attr = synIDattr(synID(lnum, 1, 1), "name")
if attr != '' && attr !~ 'vimLetHereDoc'
return indent(lnum)
endif
let lnum -= 1

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@
" Tom Payne <tom@tompayne.org>
" Contributor: Johannes Ranke <jranke@uni-bremen.de>
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
" Last Change: Wed Aug 01, 2018 10:10PM
" Last Change: Sun Mar 28, 2021 01:47PM
" Filenames: *.R *.r *.Rhistory *.Rt
"
" NOTE: The highlighting of R functions might be defined in
@ -53,12 +53,12 @@ syn match rCommentTodo contained "\(BUG\|FIXME\|NOTE\|TODO\):"
syn match rTodoParen contained "\(BUG\|FIXME\|NOTE\|TODO\)\s*(.\{-})\s*:" contains=rTodoKeyw,rTodoInfo transparent
syn keyword rTodoKeyw BUG FIXME NOTE TODO contained
syn match rTodoInfo "(\zs.\{-}\ze)" contained
syn match rComment contains=@Spell,rCommentTodo,rTodoParen,rOBlock "#.*"
syn match rComment contains=@Spell,rCommentTodo,rTodoParen "#.*"
" Roxygen
if g:r_syntax_hl_roxygen
" A roxygen block can start at the beginning of a file (first version) and
" after a blank line (second version). It ends when a line that does not
" after a blank line (second version). It ends when a line appears that does not
" contain a roxygen comment. In the following comments, any line containing
" a roxygen comment marker (one or two hash signs # followed by a single
" quote ' and preceded only by whitespace) is called a roxygen line. A
@ -71,6 +71,12 @@ if g:r_syntax_hl_roxygen
syn match rOTitleBlock "\%^\(\s*#\{1,2}' .*\n\)\{1,}" contains=rOCommentKey,rOTitleTag
syn match rOTitleBlock "^\s*\n\(\s*#\{1,2}' .*\n\)\{1,}" contains=rOCommentKey,rOTitleTag
" A title as part of a block is always at the beginning of the block, i.e.
" either at the start of a file or after a completely empty line.
syn match rOTitle "\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" contained contains=rOCommentKey,rOTitleTag
syn match rOTitle "^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" contained contains=rOCommentKey,rOTitleTag
syn match rOTitleTag contained "@title"
" When a roxygen block has a title and additional content, the title
" consists of one or more roxygen lines (as little as possible are matched),
" followed either by an empty roxygen line
@ -87,16 +93,15 @@ if g:r_syntax_hl_roxygen
syn region rOBlockNoTitle start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @describeIn" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold
syn region rOBlockNoTitle start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @describeIn" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold
" A title as part of a block is always at the beginning of the block, i.e.
" either at the start of a file or after a completely empty line.
syn match rOTitle "\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" contained contains=rOCommentKey,rOTitleTag
syn match rOTitle "^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" contained contains=rOCommentKey,rOTitleTag
syn match rOTitleTag contained "@title"
syn match rOCommentKey "^\s*#\{1,2}'" contained
syn region rOExamples start="^#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOTag fold
syn region rOExamples start="^\s*#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOTag fold
" rOTag list generated from the lists in
" R6 classes may contain roxygen lines independent of roxygen blocks
syn region rOR6Class start=/R6Class(/ end=/)/ transparent contains=ALLBUT,rError,rBraceError,rCurlyError fold
syn match rOR6Block "#\{1,2}'.*" contains=rOTag,rOExamples,@Spell containedin=rOR6Class contained
syn match rOR6Block "^\s*#\{1,2}'.*" contains=rOTag,rOExamples,@Spell containedin=rOR6Class contained
" rOTag list originally generated from the lists that were available in
" https://github.com/klutometis/roxygen/R/rd.R and
" https://github.com/klutometis/roxygen/R/namespace.R
" using s/^ \([A-Za-z0-9]*\) = .*/ syn match rOTag contained "@\1"/
@ -155,7 +160,10 @@ if g:r_syntax_hl_roxygen
syn match rOTag contained "@S3method"
syn match rOTag contained "@useDynLib"
" other
syn match rOTag contained "@eval"
syn match rOTag contained "@include"
syn match rOTag contained "@includeRmd"
syn match rOTag contained "@order"
endif
@ -186,6 +194,11 @@ syn match rSpecial display contained "\\U\x\{1,8}"
syn match rSpecial display contained "\\u{\x\{1,4}}"
syn match rSpecial display contained "\\U{\x\{1,8}}"
" Raw string
syn region rRawString matchgroup=rRawStrDelim start=/[rR]\z(['"]\)\z(-*\)(/ end=/)\z2\z1/ keepend
syn region rRawString matchgroup=rRawStrDelim start=/[rR]\z(['"]\)\z(-*\){/ end=/}\z2\z1/ keepend
syn region rRawString matchgroup=rRawStrDelim start=/[rR]\z(['"]\)\z(-*\)\[/ end=/\]\z2\z1/ keepend
" Statement
syn keyword rStatement break next return
syn keyword rConditional if else
@ -354,6 +367,8 @@ hi def link rOperator Operator
hi def link rOpError Error
hi def link rParenError Error
hi def link rPreProc PreProc
hi def link rRawString String
hi def link rRawStrDelim Delimiter
hi def link rRepeat Repeat
hi def link rSpecial SpecialChar
hi def link rStatement Statement
@ -366,6 +381,7 @@ if g:r_syntax_hl_roxygen
hi def link rOTitleBlock Title
hi def link rOBlock Comment
hi def link rOBlockNoTitle Comment
hi def link rOR6Block Comment
hi def link rOTitle Title
hi def link rOCommentKey Comment
hi def link rOExamples SpecialComment

1971
runtime/syntax/raku.vim Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
" markdown Text with R statements
" Language: markdown with R code chunks
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
" Last Change: Thu Apr 18, 2019 09:17PM
" Last Change: Wed Apr 21, 2021 09:55AM
"
" For highlighting pandoc extensions to markdown like citations and TeX and
" many other advanced features like folding of markdown sections, it is
@ -13,27 +13,45 @@ if exists("b:current_syntax")
finish
endif
" Configuration if not using pandoc syntax:
" Add syntax highlighting of YAML header
let g:rmd_syn_hl_yaml = get(g:, 'rmd_syn_hl_yaml', 1)
" Add syntax highlighting of citation keys
let g:rmd_syn_hl_citations = get(g:, 'rmd_syn_hl_citations', 1)
" Highlight the header of the chunk of R code
let g:rmd_syn_hl_chunk = get(g:, 'g:rmd_syn_hl_chunk', 0)
" Highlight the header of the chunks as R code
let g:rmd_syn_hl_chunk = get(g:, 'rmd_syn_hl_chunk', 0)
" Pandoc-syntax has more features, but it is slower.
" https://github.com/vim-pandoc/vim-pandoc-syntax
let g:pandoc#syntax#codeblocks#embeds#langs = get(g:, 'pandoc#syntax#codeblocks#embeds#langs', ['r'])
runtime syntax/pandoc.vim
if exists("b:current_syntax")
" Fix recognition of R code
syn region pandocDelimitedCodeBlock_r start=/^```{r\>.*}$/ end=/^```$/ contained containedin=pandocDelimitedCodeBlock contains=@R
" Recognize inline R code
syn region rmdrInline matchgroup=rmdInlineDelim start="`r " end="`" contains=@R containedin=pandocLaTeXRegion,yamlFlowString keepend
hi def link rmdInlineDelim Delimiter
" Fix recognition of language chunks (code adapted from pandoc, 2021-03-28)
" Knitr requires braces in the block's header
for s:lng in g:pandoc#syntax#codeblocks#embeds#langs
let s:nm = matchstr(s:lng, '^[^=]*')
exe 'syn clear pandocDelimitedCodeBlock_'.s:nm
exe 'syn clear pandocDelimitedCodeBlockinBlockQuote_'.s:nm
if g:rmd_syn_hl_chunk
exe 'syn region rmd'.s:nm.'ChunkDelim matchgroup=rmdCodeDelim start="^\s*```\s*{\s*'.s:nm.'\>" matchgroup=rmdCodeDelim end="}$" keepend containedin=rmd'.s:nm.'Chunk contains=@R'
exe 'syn region rmd'.s:nm.'Chunk start="^\s*```\s*{\s*'.s:nm.'\>.*$" matchgroup=rmdCodeDelim end="^\s*```\ze\s*$" keepend contains=rmd'.s:nm.'ChunkDelim,@'.toupper(s:nm)
else
exe 'syn region rmd'.s:nm.'Chunk matchgroup=rmdCodeDelim start="^\s*```\s*{\s*'.s:nm.'\>.*$" matchgroup=rmdCodeDelim end="^\s*```\ze\s*$" keepend contains=@'.toupper(s:nm)
endif
endfor
unlet s:lng
unlet s:nm
hi def link rmdInlineDelim Delimiter
hi def link rmdCodeDelim Delimiter
let b:current_syntax = "rmd"
finish
endif
" Configuration if not using pandoc syntax:
" Add syntax highlighting of YAML header
let g:rmd_syn_hl_yaml = get(g:, 'rmd_syn_hl_yaml', 1)
" Add syntax highlighting of citation keys
let g:rmd_syn_hl_citations = get(g:, 'rmd_syn_hl_citations', 1)
let s:cpo_save = &cpo
set cpo&vim
@ -63,15 +81,17 @@ for s:type in g:rmd_fenced_languages
unlet! b:current_syntax
exe 'syn include @Rmd'.s:nm.' syntax/'.s:ft.'.vim'
if g:rmd_syn_hl_chunk
exe 'syn region rmd'.s:nm.'ChunkDelim matchgroup=rmdCodeDelim start="^\s*```\s*{\s*'.s:nm.'\>" matchgroup=rmdCodeDelim end="}$" keepend containedin=rmd'.s:nm.'Chunk contains=@Rmd'.s:nm
exe 'syn region rmd'.s:nm.'ChunkDelim matchgroup=rmdCodeDelim start="^\s*```\s*{\s*'.s:nm.'\>" matchgroup=rmdCodeDelim end="}$" keepend containedin=rmd'.s:nm.'Chunk contains=@Rmdr'
exe 'syn region rmd'.s:nm.'Chunk start="^\s*```\s*{\s*'.s:nm.'\>.*$" matchgroup=rmdCodeDelim end="^\s*```\ze\s*$" keepend contains=rmd'.s:nm.'ChunkDelim,@Rmd'.s:nm
else
exe 'syn region rmd'.s:nm.'Chunk matchgroup=rmdCodeDelim start="^\s*```\s*{\s*'.s:nm.'\>.*$" matchgroup=rmdCodeDelim end="^\s*```\ze\s*$" keepend contains=@Rmd'.s:nm
endif
exe 'syn region rmd'.s:nm.'Inline matchgroup=rmdInlineDelim start="`'.s:nm.' " end="`" contains=@Rmd'.s:nm.' keepend'
endfor
unlet! s:type
" Recognize inline R code
syn region rmdrInline matchgroup=rmdInlineDelim start="`r " end="`" contains=@Rmdr keepend
hi def link rmdInlineDelim Delimiter
hi def link rmdCodeDelim Delimiter

View File

@ -33,8 +33,8 @@ 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 rnowebChunk matchgroup=rnowebDelimiter start="^\s*<<.*>>=" matchgroup=rnowebDelimiter end="^@" contains=@rnowebR,rnowebChunkReference,rnowebChunk fold keepend
syn match rnowebChunkReference "^\s*<<.*>>$" contained
syn region rnowebSexpr matchgroup=Delimiter start="\\Sexpr{" matchgroup=Delimiter end="}" contains=@rnowebR contained
" Sweave options command {{{1