1
0
forked from aniani/vim

Update runtime files

This commit is contained in:
Bram Moolenaar 2023-02-27 15:49:53 +00:00
parent 341f3876b3
commit dd60c365cd
35 changed files with 686 additions and 206 deletions

View File

@ -1121,13 +1121,8 @@ def Is_IN_KeywordForLoop(line_1: string, line_2: string): bool # {{{3
enddef
def InCommentOrString(): bool # {{{3
for synID: number in synstack('.', col('.'))
if synIDattr(synID, 'name') =~ '\ccomment\|string\|heredoc'
return true
endif
endfor
return false
return synstack('.', col('.'))
->indexof((_, id: number): bool => synIDattr(id, 'name') =~ '\ccomment\|string\|heredoc') >= 0
enddef
def AlsoClosesBlock(line_B: dict<any>): bool # {{{3

View File

@ -22,8 +22,7 @@ let s:maxoff = 50 " maximum number of lines to look backwards for ()
function s:SearchBracket(fromlnum, flags)
return searchpairpos('[[({]', '', '[])}]', a:flags,
\ {-> synstack('.', col('.'))
\ ->map({_, id -> id->synIDattr('name')})
\ ->match('\%(Comment\|Todo\|String\)$') >= 0},
\ ->indexof({_, id -> synIDattr(id, 'name') =~ '\%(Comment\|Todo\|String\)$'}) >= 0},
\ [0, a:fromlnum - s:maxoff]->max(), g:python_indent.searchpair_timeout)
endfunction
@ -157,15 +156,13 @@ function python#GetIndent(lnum, ...)
" the start of the comment. synID() is slow, a linear search would take
" too long on a long line.
if synstack(plnum, pline_len)
\ ->map({_, id -> id->synIDattr('name')})
\ ->match('\%(Comment\|Todo\)$') >= 0
\ ->indexof({_, id -> synIDattr(id, 'name') =~ '\%(Comment\|Todo\)$'}) >= 0
let min = 1
let max = pline_len
while min < max
let col = (min + max) / 2
if synstack(plnum, col)
\ ->map({_, id -> id->synIDattr('name')})
\ ->match('\%(Comment\|Todo\)$') >= 0
\ ->indexof({_, id -> synIDattr(id, 'name') =~ '\%(Comment\|Todo\)$'}) >= 0
let max = col
else
let min = col + 1

View File

@ -1,4 +1,4 @@
*builtin.txt* For Vim version 9.0. Last change: 2023 Feb 14
*builtin.txt* For Vim version 9.0. Last change: 2023 Feb 27
VIM REFERENCE MANUAL by Bram Moolenaar
@ -2569,8 +2569,7 @@ extend({expr1}, {expr2} [, {expr3}]) *extend()*
extendnew({expr1}, {expr2} [, {expr3}]) *extendnew()*
Like |extend()| but instead of adding items to {expr1} a new
List or Dictionary is created and returned. {expr1} remains
unchanged. Items can still be changed by {expr2}, if you
don't want that use |deepcopy()| first.
unchanged.
feedkeys({string} [, {mode}]) *feedkeys()*
@ -9811,6 +9810,8 @@ timer_start({time}, {callback} [, {options}])
{time} is the waiting time in milliseconds. This is the
minimum time before invoking the callback. When the system is
busy or Vim is not waiting for input the time will be longer.
Zero can be used to execute the callback when Vim is back in
the main loop.
{callback} is the function to call. It can be the name of a
function or a |Funcref|. It is called with one argument, which

View File

@ -1,4 +1,4 @@
*change.txt* For Vim version 9.0. Last change: 2022 Nov 20
*change.txt* For Vim version 9.0. Last change: 2023 Feb 27
VIM REFERENCE MANUAL by Bram Moolenaar
@ -296,7 +296,9 @@ gr{char} Replace the virtual characters under the cursor with
{char}. This replaces in screen space, not file
space. See |gR| and |Virtual-Replace-mode| for more
details. As with |r| a count may be given.
{char} can be entered like with |r|.
{char} can be entered like with |r|, but characters
that have a special meaning in Insert mode, such as
most CTRL-keys, cannot be used.
*digraph-arg*
The argument for Normal mode commands like |r| and |t| is a single character.
@ -1033,7 +1035,7 @@ inside of strings can change! Also see 'softtabstop' option. >
< to display registers '1' and 'a'. Spaces are allowed
in {arg}.
*:di* *:display*
*:di* *:dis* *:display*
:di[splay] [arg] Same as :registers.
*y* *yank*
@ -1842,9 +1844,9 @@ editing text paragraphs. A few hints on how to use this:
- Set 'formatoptions' to "aw2tq" to make text with indents like this:
bla bla foobar bla
bla bla foobar bla
bla foobar bla foobar bla
bla bla foobar bla
bla bla foobar bla
bla foobar bla bla foobar
- Add the 'c' flag to only auto-format comments. Useful in source code.

View File

@ -1,4 +1,4 @@
*eval.txt* For Vim version 9.0. Last change: 2023 Jan 12
*eval.txt* For Vim version 9.0. Last change: 2023 Feb 25
VIM REFERENCE MANUAL by Bram Moolenaar
@ -4581,10 +4581,10 @@ The input is in the variable "line", the results in the variables "file",
getting the scriptnames in a Dictionary ~
*scriptnames-dictionary*
The |:scriptnames| command can be used to get a list of all script files that
have been sourced. There is no equivalent function or variable for this
(because it's rarely needed). In case you need to manipulate the list this
code can be used: >
The `:scriptnames` command can be used to get a list of all script files that
have been sourced. There is also the `getscriptinfo()` function, but the
information returned is not exactly the same. In case you need to manipulate
the output of `scriptnames` this code can be used: >
" Get the output of ":scriptnames" in the scriptnames_output variable.
let scriptnames_output = ''
redir => scriptnames_output

View File

@ -1,4 +1,4 @@
*gui.txt* For Vim version 9.0. Last change: 2022 Nov 17
*gui.txt* For Vim version 9.0. Last change: 2023 Feb 26
VIM REFERENCE MANUAL by Bram Moolenaar
@ -856,7 +856,7 @@ Example for debugger tools: >
nnoremenu 1.20 WinBar.Next :Next<CR>
nnoremenu 1.30 WinBar.Finish :Finish<CR>
nnoremenu 1.40 WinBar.Cont :Continue<CR>
<
< *hl-ToolbarLine* *hl-ToolbarButton*
The window toolbar uses the ToolbarLine and ToolbarButton highlight groups.
When splitting the window the window toolbar is not copied to the new window.

View File

@ -1,4 +1,4 @@
*map.txt* For Vim version 9.0. Last change: 2023 Feb 18
*map.txt* For Vim version 9.0. Last change: 2023 Feb 27
VIM REFERENCE MANUAL by Bram Moolenaar
@ -1073,7 +1073,7 @@ translated). The meaning of {value}:
On protocol is used
Disabled protocol was used but expected to have been disabled
by 't_TE'
Cleared protocol expected to have beeen disabled by 't_TE',
Cleared protocol expected to have been disabled by 't_TE',
previous state is unknown
@ -1421,12 +1421,13 @@ this, they can be made local to the script.
*<SID>* *<SNR>* *E81*
The string "<SID>" can be used in a mapping or menu. This requires that the
'<' flag is not present in 'cpoptions'.
'<' flag is not present in 'cpoptions'. This is useful if you have a
script-local function that you want to call from a mapping in the same script.
When executing the map command, Vim will replace "<SID>" with the special
key code <SNR>, followed by a number that's unique for the script, and an
underscore. Example: >
:map <SID>Add
could define a mapping "<SNR>23_Add".
would define a mapping "<SNR>23_Add".
When defining a function in a script, "s:" can be prepended to the name to
make it local to the script (in |Vim9| script functions without a prefix are

View File

@ -1,4 +1,4 @@
*repeat.txt* For Vim version 9.0. Last change: 2022 Sep 22
*repeat.txt* For Vim version 9.0. Last change: 2023 Feb 25
VIM REFERENCE MANUAL by Bram Moolenaar
@ -423,6 +423,7 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
after resolving symbolic links got sourced with
another name the other script is after "->". E.g.
"20->22" means script 20 was sourced as script 22.
Also see `getscriptinfo()`.
{not available when compiled without the |+eval|
feature}

View File

@ -1,4 +1,4 @@
*sign.txt* For Vim version 9.0. Last change: 2022 Dec 20
*sign.txt* For Vim version 9.0. Last change: 2023 Feb 21
VIM REFERENCE MANUAL by Gordon Prieur
@ -614,23 +614,23 @@ sign_placelist({list})
|sign_place()| function. The {list} argument specifies the
List of signs to place. Each list item is a dict with the
following sign attributes:
buffer buffer name or number. For the accepted
buffer Buffer name or number. For the accepted
values, see |bufname()|.
group sign group. {group} functions as a namespace
group Sign group. {group} functions as a namespace
for {id}, thus two groups can use the same
IDs. If not specified or set to an empty
string, then the global group is used. See
|sign-group| for more information.
id sign identifier. If not specified or zero,
id Sign identifier. If not specified or zero,
then a new unique identifier is allocated.
Otherwise the specified number is used. See
|sign-identifier| for more information.
lnum line number in the buffer where the sign is to
lnum Line number in the buffer where the sign is to
be placed. For the accepted values, see
|line()|.
name name of the sign to place. See |sign_define()|
for more information.
priority priority of the sign. When multiple signs are
name Name of the sign to place. See |sign_define()|
for more information.
priority Priority of the sign. When multiple signs are
placed on a line, the sign with the highest
priority is used. If not specified, the
default value of 10 is used. See

View File

@ -1,4 +1,4 @@
*syntax.txt* For Vim version 9.0. Last change: 2023 Feb 20
*syntax.txt* For Vim version 9.0. Last change: 2023 Feb 26
VIM REFERENCE MANUAL by Bram Moolenaar
@ -2791,17 +2791,25 @@ For highlighted doctests and code inside: >
:let python_no_doctest_highlight = 1
or >
:let python_no_doctest_code_highlight = 1
(first option implies second one).
The first option implies the second one.
For highlighted trailing whitespace and mix of spaces and tabs: >
:let python_space_error_highlight = 1
If you want all possible Python highlighting (the same as setting the
preceding last option and unsetting all other ones): >
If you want all possible Python highlighting:
:let python_highlight_all = 1
This has the same effect as setting python_space_error_highlight and
unsetting all the other ones.
If you use Python 2 or straddling code (Python 2 and 3 compatible),
you can enforce the use of an older syntax file with support for
Python 2 and up to Python 3.5.
: let python_use_python2_syntax = 1
This option will exclude all modern Python 3.6 or higher features.
Note: Only existence of these options matters, not their value.
You can replace 1 above with anything.
Note: Only existence of these options matter, not their value. You can replace
1 above with anything.
QUAKE *quake.vim* *ft-quake-syntax*
@ -5370,7 +5378,7 @@ ColorColumn Used for the columns set with 'colorcolumn'.
*hl-Conceal*
Conceal Placeholder characters substituted for concealed
text (see 'conceallevel').
*hl-Cursor*
*hl-Cursor* *hl-lCursor*
Cursor Character under the cursor.
lCursor Character under the cursor when |language-mapping|
is used (see 'guicursor').

View File

@ -2459,6 +2459,7 @@ $quote eval.txt /*$quote*
:diffupdate diff.txt /*:diffupdate*
:dig digraph.txt /*:dig*
:digraphs digraph.txt /*:digraphs*
:dis change.txt /*:dis*
:disa vim9.txt /*:disa*
:disassemble vim9.txt /*:disassemble*
:display change.txt /*:display*
@ -4433,6 +4434,7 @@ E1359 vim9class.txt /*E1359*
E136 starting.txt /*E136*
E1360 vim9class.txt /*E1360*
E1361 syntax.txt /*E1361*
E1362 vim9class.txt /*E1362*
E137 starting.txt /*E137*
E138 starting.txt /*E138*
E139 message.txt /*E139*
@ -7898,6 +7900,8 @@ hl-TabLineFill syntax.txt /*hl-TabLineFill*
hl-TabLineSel syntax.txt /*hl-TabLineSel*
hl-Terminal syntax.txt /*hl-Terminal*
hl-Title syntax.txt /*hl-Title*
hl-ToolbarButton gui.txt /*hl-ToolbarButton*
hl-ToolbarLine gui.txt /*hl-ToolbarLine*
hl-Tooltip syntax.txt /*hl-Tooltip*
hl-User1 syntax.txt /*hl-User1*
hl-User1..9 syntax.txt /*hl-User1..9*
@ -7909,6 +7913,7 @@ hl-WarningMsg syntax.txt /*hl-WarningMsg*
hl-WildMenu syntax.txt /*hl-WildMenu*
hl-debugBreakpoint terminal.txt /*hl-debugBreakpoint*
hl-debugPC terminal.txt /*hl-debugPC*
hl-lCursor syntax.txt /*hl-lCursor*
hlID() builtin.txt /*hlID()*
hlexists() builtin.txt /*hlexists()*
hlget() builtin.txt /*hlget()*

View File

@ -1,4 +1,4 @@
*todo.txt* For Vim version 9.0. Last change: 2023 Feb 20
*todo.txt* For Vim version 9.0. Last change: 2023 Feb 26
VIM REFERENCE MANUAL by Bram Moolenaar
@ -41,12 +41,13 @@ browser use: https://github.com/vim/vim/issues/1234
Crash when splitting window: #11961. Set RedrawingDisabled in
win_split_ins().
Do not use tt_member for class_T, add tt_class.
CI: include #12008 end of February.
In runtime/autoload/dist/script.vim change "set ft=" to "setlocal ft=" ?
CTRL-J mapping is not used if halfway another mapping. #12002
Is simplified mapping not used but escape code has been simplified?
Include #11952 after a runtime files update.
Errors when running tests with valgrind:
@ -74,6 +75,8 @@ Further Vim9 improvements, possibly after launch:
- implement :class and :interface: See |vim9-classes
- Change access: public by default, private by prefixing "_".
Check for error: can't have same name twice (ignoring "_" prefix).
- Make ":defcompile ClassName" compile all functions and methods in the
class.
- Private methods?
either: private def Func()
or: def _Func()
@ -97,6 +100,7 @@ Further Vim9 improvements, possibly after launch:
this at runtime.
- implement :type
- implement :enum
- Promise class, could be used to wait on a popup close callback?
- class local to a function
- Use Vim9 for more runtime files.
- Inline call to map() and filter(), better type checking.
@ -320,9 +324,10 @@ to have text in the center.
Add some kind of ":whathappend" command and functions to make visible what the
last few typed keys and executed commands are. To be used when the user
wonders what went wrong.
wonders what went wrong. Could also be used for statistics #12046.
- typed keys - Normal mode command - like what is recorded in a register and
displayed by 'showcmd'.
- register used - #12063
- executed command lines
- with more verbosity: what scripts/functions/autocommands were executed
@ -701,6 +706,7 @@ Added tests (James McCoy, 2016 Aug 3, #958). Still needs more work.
Would be nice to set tab-local values for 'diffexpr' and 'diffopt'. Use
t:diffexpr_option t:diffopt_option? (#4782)
Also make 'scrollopt' tab-local, remove "hor" only for the current tab page.
Internal diff doesn't handle binary file like external diff does. (Mike
Williams, 2018 Oct 30)

View File

@ -8123,7 +8123,7 @@ Files: src/message.c
Patch 7.2.119
Problem: Status line is redrawn too often.
Solution: Check ScreeenLinesUC[] properly. (Yukihiro Nakadaira)
Solution: Check ScreenLinesUC[] properly. (Yukihiro Nakadaira)
Files: src/screen.c
Patch 7.2.120
@ -9782,8 +9782,8 @@ Files: src/syntax.c
Patch 7.2.406
Problem: Patch 7.2.119 introduces uninit mem read. (Dominique Pelle)
Solution: Only used ScreeenLinesC when ScreeenLinesUC is not zero. (Yukihiro
Nakadaira) Also clear ScreeenLinesC when allocating.
Solution: Only used ScreenLinesC when ScreenLinesUC is not zero. (Yukihiro
Nakadaira) Also clear ScreenLinesC when allocating.
Files: src/screen.c
Patch 7.2.407

View File

@ -1,4 +1,4 @@
*vim9.txt* For Vim version 9.0. Last change: 2022 Dec 08
*vim9.txt* For Vim version 9.0. Last change: 2023 Feb 21
VIM REFERENCE MANUAL by Bram Moolenaar
@ -1254,6 +1254,7 @@ level. They cannot be created in a function, also not in a legacy function.
:defc[ompile] Compile functions defined in the current script that
were not compiled yet.
This will report any errors found during compilation.
This excludes functions defined inside a class.
:defc[ompile] {func}
:defc[ompile] debug {func}
@ -1261,6 +1262,10 @@ level. They cannot be created in a function, also not in a legacy function.
Compile function {func}, if needed. Use "debug" and
"profile" to specify the compilation mode.
This will report any errors found during compilation.
{func} call also be "ClassName.functionName" to
compile a function or method in a class.
{func} call also be "ClassName" to compile all
functions and methods in a class.
*:disa* *:disassemble*
:disa[ssemble] {func} Show the instructions generated for {func}.

View File

@ -1,4 +1,4 @@
*vim9class.txt* For Vim version 9.0. Last change: 2023 Feb 19
*vim9class.txt* For Vim version 9.0. Last change: 2023 Feb 26
VIM REFERENCE MANUAL by Bram Moolenaar
@ -469,7 +469,7 @@ interface, which is often done in many languages, especially Java.
Items in a class ~
*E1318* *E1325* *E1326*
Inside a class, in betweeen `:class` and `:endclass`, these items can appear:
Inside a class, in between `:class` and `:endclass`, these items can appear:
- An object member declaration: >
this._memberName: memberType
this.memberName: memberType
@ -522,11 +522,11 @@ An interface can only be defined in a |Vim9| script file. *E1342*
null object ~
When a variable is decleared to have the type of an object, but it is not
When a variable is declared to have the type of an object, but it is not
initialized, the value is null. When trying to use this null object Vim often
does not know what class was supposed to be used. Vim then cannot check if
a member name is correct and you will get an "Using a null object" error,
even when the member name is invalid. *E1360*
even when the member name is invalid. *E1360* *E1362*
Default constructor ~

View File

@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2023 Feb 07
" Last Change: 2023 Feb 25
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")

View File

@ -0,0 +1 @@
runtime ftplugin/rmd.vim

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: Sat Aug 15, 2020 11:37AM
" Last Change: Sun Apr 24, 2022 09:14AM
" Only do this when not yet done for this buffer
if exists("b:did_ftplugin")
@ -22,7 +22,7 @@ setlocal comments=:#',:###,:##,:#
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" .
\ "Files that include R (*.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" .
\ "All Files (*.*)\t*.*\n"
endif

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: Sat Aug 15, 2020 12:01PM
" Last Change: Sun Apr 24, 2022 09:12AM
" Only do this when not yet done for this buffer
if exists("b:did_ftplugin")
@ -18,7 +18,7 @@ set cpo&vim
setlocal iskeyword=@,48-57,_,.
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" .
let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\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: Sat Aug 15, 2020 12:03PM
" Last Change: Sun Apr 24, 2022 09:12AM
" Original work by Alex Zvoleff (adjusted from R help for rmd by Michel Kuhlmann)
" Only do this when not yet done for this buffer
@ -32,13 +32,24 @@ function! FormatRmd()
return 1
endfunction
" If you do not want 'comments' dynamically defined, put in your vimrc:
" let g:rmd_dynamic_comments = 0
function! SetRmdCommentStr()
if (search("^[ \t]*```[ ]*{r", "bncW") > search("^[ \t]*```$", "bncW")) || ((search('^---$', 'Wn') || search('^\.\.\.$', 'Wn')) && search('^---$', 'bnW'))
set commentstring=#\ %s
else
set commentstring=<!--\ %s\ -->
endif
endfunction
" If you do not want both 'comments' and 'commentstring' dynamically defined,
" put in your vimrc: let g:rmd_dynamic_comments = 0
if !exists("g:rmd_dynamic_comments") || (exists("g:rmd_dynamic_comments") && g:rmd_dynamic_comments == 1)
setlocal formatexpr=FormatRmd()
augroup RmdCStr
autocmd!
autocmd CursorMoved <buffer> call SetRmdCommentStr()
augroup END
endif
" Enables pandoc if it is installed
unlet! b:did_ftplugin
runtime ftplugin/pandoc.vim
@ -47,7 +58,7 @@ runtime ftplugin/pandoc.vim
let b:did_ftplugin = 1
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" .
let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\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: Sat Aug 15, 2020 12:02PM
" Last Change: Sun Apr 24, 2022 09:13AM
" Only do this when not yet done for this buffer
if exists("b:did_ftplugin")
@ -25,10 +25,27 @@ setlocal suffixesadd=.bib,.tex
setlocal comments=b:%,b:#,b:##,b:###,b:#'
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" .
let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" .
\ "All Files (*.*)\t*.*\n"
endif
function! SetRnwCommentStr()
if (search("^\s*<<.*>>=", "bncW") > search("^@", "bncW"))
set commentstring=#\ %s
else
set commentstring=%\ %s
endif
endfunction
" If you do not want both 'comments' and 'commentstring' dynamically defined,
" put in your vimrc: let g:rnw_dynamic_comments = 0
if !exists("g:rnw_dynamic_comments") || (exists("g:rnw_dynamic_comments") && g:rnw_dynamic_comments == 1)
augroup RnwCStr
autocmd!
autocmd CursorMoved <buffer> call SetRnwCommentStr()
augroup END
endif
if exists('b:undo_ftplugin')
let b:undo_ftplugin .= " | setl isk< sua< com< | unlet! b:browsefilter"
else

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: Sat Aug 15, 2020 12:02PM
" Last Change: Sun Apr 24, 2022 09:13AM
" Original work by Alex Zvoleff
" Only do this when not yet done for this buffer
@ -38,7 +38,7 @@ if !exists("g:rrst_dynamic_comments") || (exists("g:rrst_dynamic_comments") && g
endif
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" .
let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" .
\ "All Files (*.*)\t*.*\n"
endif

View File

@ -0,0 +1 @@
runtime indent/rmd.vim

View File

@ -2,7 +2,7 @@
" Language: R
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
" Last Change: Sun Aug 19, 2018 09:13PM
" Last Change: Wed Oct 26, 2022 12:04PM
" Only load this indent file when no other was loaded.
@ -14,6 +14,8 @@ let b:did_indent = 1
setlocal indentkeys=0{,0},:,!^F,o,O,e
setlocal indentexpr=GetRIndent()
let b:undo_indent = "setl inde< indk<"
" Only define the function once.
if exists("*GetRIndent")
finish
@ -28,7 +30,7 @@ let g:r_indent_ess_comments = get(g:, 'r_indent_ess_comments', 0)
let g:r_indent_comment_column = get(g:, 'r_indent_comment_column', 40)
let g:r_indent_ess_compatible = get(g:, 'r_indent_ess_compatible', 0)
let g:r_indent_op_pattern = get(g:, 'r_indent_op_pattern',
\ '\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\)\s*$')
\ '\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\||>\)\s*$')
function s:RDelete_quotes(line)
let i = 0
@ -359,17 +361,19 @@ function GetRIndent()
let olnum = s:Get_prev_line(lnum)
let oline = getline(olnum)
if olnum > 0
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
if substitute(line, '#.*', '', '') =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
if substitute(oline, '#.*', '', '') =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
return indent(lnum)
else
return indent(lnum) + shiftwidth()
endif
else
if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
if substitute(oline, '#.*', '', '') =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
return indent(lnum) - shiftwidth()
endif
endif
elseif substitute(line, '#.*', '', '') =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
return indent(lnum) + shiftwidth()
endif
let post_fun = 0

View File

@ -2,7 +2,7 @@
" Language: R Documentation (Help), *.Rd
" Author: 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: Feb 25, 2023
" Only load this indent file when no other was loaded.
@ -20,6 +20,8 @@ setlocal nolisp
setlocal indentkeys=0{,0},:,!^F,o,O,e
setlocal indentexpr=GetCorrectRHelpIndent()
let b:undo_indent = "setl ai< cin< inde< indk< <lisp <si"
" Only define the functions once.
if exists("*GetRHelpIndent")
finish

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 Mar 28, 2021 08:05PM
" Last Change: Wed Nov 09, 2022 09:44PM
" Only load this indent file when no other was loaded.
@ -16,6 +16,8 @@ let b:did_indent = 1
setlocal indentkeys=0{,0},<:>,!^F,o,O,e
setlocal indentexpr=GetRmdIndent()
let b:undo_indent = "setl inde< indk<"
if exists("*GetRmdIndent")
finish
endif
@ -47,6 +49,8 @@ function s:GetMdIndent()
return indent(v:lnum - 1) + 2
elseif pline =~ '^\s*\d\+\.\s\+'
return indent(v:lnum - 1) + 3
elseif pline =~ '^\[\^\S\+\]: '
return indent(v:lnum - 1) + shiftwidth()
endif
return indent(prevnonblank(v:lnum - 1))
endfunction

View File

@ -2,7 +2,7 @@
" Language: Rnoweb
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
" Last Change: Fri Apr 15, 2016 10:58PM
" Last Change: Feb 25, 2023
" Only load this indent file when no other was loaded.
@ -29,6 +29,8 @@ let b:did_indent = 1
setlocal indentkeys=0{,0},!^F,o,O,e,},=\bibitem,=\item
setlocal indentexpr=GetRnowebIndent()
let b:undo_indent = "setl inde< indk<"
if exists("*GetRnowebIndent")
finish
endif

View File

@ -2,7 +2,7 @@
" Language: Rrst
" Author: 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: Feb 25, 2023
" Only load this indent file when no other was loaded.
@ -16,6 +16,8 @@ let b:did_indent = 1
setlocal indentkeys=0{,0},:,!^F,o,O,e
setlocal indentexpr=GetRrstIndent()
let b:undo_indent = "setl inde< indk<"
if exists("*GetRrstIndent")
finish
endif

View File

@ -108,8 +108,9 @@ func s:Highlight_Matching_Pair()
" searchpairpos()'s skip argument.
" We match "escape" for special items, such as lispEscapeSpecial, and
" match "symbol" for lispBarSymbol.
let s_skip = '!empty(filter(map(synstack(line("."), col(".")), ''synIDattr(v:val, "name")''), ' .
\ '''v:val =~? "string\\|character\\|singlequote\\|escape\\|symbol\\|comment"''))'
let s_skip = 'synstack(".", col("."))'
\ . '->indexof({_, id -> synIDattr(id, "name") =~? '
\ . '"string\\|character\\|singlequote\\|escape\\|symbol\\|comment"}) >= 0'
" If executing the expression determines that the cursor is currently in
" one of the syntax types, then we want searchpairpos() to find the pair
" within those syntax types (i.e., not skip). Otherwise, the cursor is

View File

@ -1,7 +1,7 @@
" Vim syntax file
" Language: Python
" Maintainer: Zvezdan Petkovic <zpetkovic@acm.org>
" Last Change: 2022 Jun 28
" Last Change: 2023 Feb 26
" Credits: Neil Schemenauer <nas@python.ca>
" Dmitry Vasiliev
"
@ -35,12 +35,26 @@
"
" let python_highlight_all = 1
"
" The use of Python 2 compatible syntax highlighting can be enforced.
" The straddling code (Python 2 and 3 compatible), up to Python 3.5,
" will be also supported.
"
" let python_use_python2_syntax = 1
"
" This option will exclude all modern Python 3.6 or higher features.
"
" quit when a syntax file was already loaded.
if exists("b:current_syntax")
finish
endif
" Use of Python 2 and 3.5 or lower requested.
if exists("python_use_python2_syntax")
runtime! syntax/python2.vim
finish
endif
" We need nocompatible mode in order to continue lines with backslashes.
" Original setting will be restored.
let s:cpo_save = &cpo
@ -91,8 +105,8 @@ syn keyword pythonInclude from import
syn keyword pythonAsync async await
" Soft keywords
" These keywords do not mean anything unless used in the right context
" See https://docs.python.org/3/reference/lexical_analysis.html#soft-keywords
" These keywords do not mean anything unless used in the right context.
" See https://docs.python.org/3/reference/lexical_analysis.html#soft-keywords
" for more on this.
syn match pythonConditional "^\s*\zscase\%(\s\+.*:.*$\)\@="
syn match pythonConditional "^\s*\zsmatch\%(\s\+.*:\s*\%(#.*\)\=$\)\@="

345
runtime/syntax/python2.vim Normal file
View File

@ -0,0 +1,345 @@
" Vim syntax file
" Language: Python 2
" Maintainer: Zvezdan Petkovic <zpetkovic@acm.org>
" Last Change: 2016 Oct 29
" Credits: Neil Schemenauer <nas@python.ca>
" Dmitry Vasiliev
"
" This version is a major rewrite by Zvezdan Petkovic.
"
" - introduced highlighting of doctests
" - updated keywords, built-ins, and exceptions
" - corrected regular expressions for
"
" * functions
" * decorators
" * strings
" * escapes
" * numbers
" * space error
"
" - corrected synchronization
" - more highlighting is ON by default, except
" - space error highlighting is OFF by default
"
" Optional highlighting can be controlled using these variables.
"
" let python_no_builtin_highlight = 1
" let python_no_doctest_code_highlight = 1
" let python_no_doctest_highlight = 1
" let python_no_exception_highlight = 1
" let python_no_number_highlight = 1
" let python_space_error_highlight = 1
"
" All the options above can be switched on together.
"
" let python_highlight_all = 1
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" NOTE: This file is a copy of the last commit of runtime/syntax/python.vim
" that still supported Python 2. There is support for Python 3, up to 3.5,
" and it was kept in the file as is, because it supports the straddling code
" (Python 2 and 3 compatible) better.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" quit when a syntax file was already loaded.
if exists("b:current_syntax")
finish
endif
" We need nocompatible mode in order to continue lines with backslashes.
" Original setting will be restored.
let s:cpo_save = &cpo
set cpo&vim
if exists("python_no_doctest_highlight")
let python_no_doctest_code_highlight = 1
endif
if exists("python_highlight_all")
if exists("python_no_builtin_highlight")
unlet python_no_builtin_highlight
endif
if exists("python_no_doctest_code_highlight")
unlet python_no_doctest_code_highlight
endif
if exists("python_no_doctest_highlight")
unlet python_no_doctest_highlight
endif
if exists("python_no_exception_highlight")
unlet python_no_exception_highlight
endif
if exists("python_no_number_highlight")
unlet python_no_number_highlight
endif
let python_space_error_highlight = 1
endif
" Keep Python keywords in alphabetical order inside groups for easy
" comparison with the table in the 'Python Language Reference'
" https://docs.python.org/2/reference/lexical_analysis.html#keywords,
" https://docs.python.org/3/reference/lexical_analysis.html#keywords.
" Groups are in the order presented in NAMING CONVENTIONS in syntax.txt.
" Exceptions come last at the end of each group (class and def below).
"
" Keywords 'with' and 'as' are new in Python 2.6
" (use 'from __future__ import with_statement' in Python 2.5).
"
" Some compromises had to be made to support both Python 3 and 2.
" We include Python 3 features, but when a definition is duplicated,
" the last definition takes precedence.
"
" - 'False', 'None', and 'True' are keywords in Python 3 but they are
" built-ins in 2 and will be highlighted as built-ins below.
" - 'exec' is a built-in in Python 3 and will be highlighted as
" built-in below.
" - 'nonlocal' is a keyword in Python 3 and will be highlighted.
" - 'print' is a built-in in Python 3 and will be highlighted as
" built-in below (use 'from __future__ import print_function' in 2)
" - async and await were added in Python 3.5 and are soft keywords.
"
syn keyword pythonStatement False None True
syn keyword pythonStatement as assert break continue del exec global
syn keyword pythonStatement lambda nonlocal pass print return with yield
syn keyword pythonStatement class def nextgroup=pythonFunction skipwhite
syn keyword pythonConditional elif else if
syn keyword pythonRepeat for while
syn keyword pythonOperator and in is not or
syn keyword pythonException except finally raise try
syn keyword pythonInclude from import
syn keyword pythonAsync async await
" Decorators (new in Python 2.4)
" A dot must be allowed because of @MyClass.myfunc decorators.
syn match pythonDecorator "@" display contained
syn match pythonDecoratorName "@\s*\h\%(\w\|\.\)*" display contains=pythonDecorator
" Python 3.5 introduced the use of the same symbol for matrix multiplication:
" https://www.python.org/dev/peps/pep-0465/. We now have to exclude the
" symbol from highlighting when used in that context.
" Single line multiplication.
syn match pythonMatrixMultiply
\ "\%(\w\|[])]\)\s*@"
\ contains=ALLBUT,pythonDecoratorName,pythonDecorator,pythonFunction,pythonDoctestValue
\ transparent
" Multiplication continued on the next line after backslash.
syn match pythonMatrixMultiply
\ "[^\\]\\\s*\n\%(\s*\.\.\.\s\)\=\s\+@"
\ contains=ALLBUT,pythonDecoratorName,pythonDecorator,pythonFunction,pythonDoctestValue
\ transparent
" Multiplication in a parenthesized expression over multiple lines with @ at
" the start of each continued line; very similar to decorators and complex.
syn match pythonMatrixMultiply
\ "^\s*\%(\%(>>>\|\.\.\.\)\s\+\)\=\zs\%(\h\|\%(\h\|[[(]\).\{-}\%(\w\|[])]\)\)\s*\n\%(\s*\.\.\.\s\)\=\s\+@\%(.\{-}\n\%(\s*\.\.\.\s\)\=\s\+@\)*"
\ contains=ALLBUT,pythonDecoratorName,pythonDecorator,pythonFunction,pythonDoctestValue
\ transparent
syn match pythonFunction "\h\w*" display contained
syn match pythonComment "#.*$" contains=pythonTodo,@Spell
syn keyword pythonTodo FIXME NOTE NOTES TODO XXX contained
" Triple-quoted strings can contain doctests.
syn region pythonString matchgroup=pythonQuotes
\ start=+[uU]\=\z(['"]\)+ end="\z1" skip="\\\\\|\\\z1"
\ contains=pythonEscape,@Spell
syn region pythonString matchgroup=pythonTripleQuotes
\ start=+[uU]\=\z('''\|"""\)+ end="\z1" keepend
\ contains=pythonEscape,pythonSpaceError,pythonDoctest,@Spell
syn region pythonRawString matchgroup=pythonQuotes
\ start=+[uU]\=[rR]\z(['"]\)+ end="\z1" skip="\\\\\|\\\z1"
\ contains=@Spell
syn region pythonRawString matchgroup=pythonTripleQuotes
\ start=+[uU]\=[rR]\z('''\|"""\)+ end="\z1" keepend
\ contains=pythonSpaceError,pythonDoctest,@Spell
syn match pythonEscape +\\[abfnrtv'"\\]+ contained
syn match pythonEscape "\\\o\{1,3}" contained
syn match pythonEscape "\\x\x\{2}" contained
syn match pythonEscape "\%(\\u\x\{4}\|\\U\x\{8}\)" contained
" Python allows case-insensitive Unicode IDs: http://www.unicode.org/charts/
syn match pythonEscape "\\N{\a\+\%(\s\a\+\)*}" contained
syn match pythonEscape "\\$"
" It is very important to understand all details before changing the
" regular expressions below or their order.
" The word boundaries are *not* the floating-point number boundaries
" because of a possible leading or trailing decimal point.
" The expressions below ensure that all valid number literals are
" highlighted, and invalid number literals are not. For example,
"
" - a decimal point in '4.' at the end of a line is highlighted,
" - a second dot in 1.0.0 is not highlighted,
" - 08 is not highlighted,
" - 08e0 or 08j are highlighted,
"
" and so on, as specified in the 'Python Language Reference'.
" https://docs.python.org/2/reference/lexical_analysis.html#numeric-literals
" https://docs.python.org/3/reference/lexical_analysis.html#numeric-literals
if !exists("python_no_number_highlight")
" numbers (including longs and complex)
syn match pythonNumber "\<0[oO]\=\o\+[Ll]\=\>"
syn match pythonNumber "\<0[xX]\x\+[Ll]\=\>"
syn match pythonNumber "\<0[bB][01]\+[Ll]\=\>"
syn match pythonNumber "\<\%([1-9]\d*\|0\)[Ll]\=\>"
syn match pythonNumber "\<\d\+[jJ]\>"
syn match pythonNumber "\<\d\+[eE][+-]\=\d\+[jJ]\=\>"
syn match pythonNumber
\ "\<\d\+\.\%([eE][+-]\=\d\+\)\=[jJ]\=\%(\W\|$\)\@="
syn match pythonNumber
\ "\%(^\|\W\)\zs\d*\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>"
endif
" Group the built-ins in the order in the 'Python Library Reference' for
" easier comparison.
" https://docs.python.org/2/library/constants.html
" https://docs.python.org/3/library/constants.html
" http://docs.python.org/2/library/functions.html
" http://docs.python.org/3/library/functions.html
" http://docs.python.org/2/library/functions.html#non-essential-built-in-functions
" http://docs.python.org/3/library/functions.html#non-essential-built-in-functions
" Python built-in functions are in alphabetical order.
if !exists("python_no_builtin_highlight")
" built-in constants
" 'False', 'True', and 'None' are also reserved words in Python 3
syn keyword pythonBuiltin False True None
syn keyword pythonBuiltin NotImplemented Ellipsis __debug__
" built-in functions
syn keyword pythonBuiltin abs all any bin bool bytearray callable chr
syn keyword pythonBuiltin classmethod compile complex delattr dict dir
syn keyword pythonBuiltin divmod enumerate eval filter float format
syn keyword pythonBuiltin frozenset getattr globals hasattr hash
syn keyword pythonBuiltin help hex id input int isinstance
syn keyword pythonBuiltin issubclass iter len list locals map max
syn keyword pythonBuiltin memoryview min next object oct open ord pow
syn keyword pythonBuiltin print property range repr reversed round set
syn keyword pythonBuiltin setattr slice sorted staticmethod str
syn keyword pythonBuiltin sum super tuple type vars zip __import__
" Python 2 only
syn keyword pythonBuiltin basestring cmp execfile file
syn keyword pythonBuiltin long raw_input reduce reload unichr
syn keyword pythonBuiltin unicode xrange
" Python 3 only
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,pythonFunction,pythonAsync
\ transparent
endif
" From the 'Python Library Reference' class hierarchy at the bottom.
" http://docs.python.org/2/library/exceptions.html
" http://docs.python.org/3/library/exceptions.html
if !exists("python_no_exception_highlight")
" builtin base exceptions (used mostly as base classes for other exceptions)
syn keyword pythonExceptions BaseException Exception
syn keyword pythonExceptions ArithmeticError BufferError
syn keyword pythonExceptions LookupError
" builtin base exceptions removed in Python 3
syn keyword pythonExceptions EnvironmentError StandardError
" builtin exceptions (actually raised)
syn keyword pythonExceptions AssertionError AttributeError
syn keyword pythonExceptions EOFError FloatingPointError GeneratorExit
syn keyword pythonExceptions ImportError IndentationError
syn keyword pythonExceptions IndexError KeyError KeyboardInterrupt
syn keyword pythonExceptions MemoryError NameError NotImplementedError
syn keyword pythonExceptions OSError OverflowError ReferenceError
syn keyword pythonExceptions RuntimeError StopIteration SyntaxError
syn keyword pythonExceptions SystemError SystemExit TabError TypeError
syn keyword pythonExceptions UnboundLocalError UnicodeError
syn keyword pythonExceptions UnicodeDecodeError UnicodeEncodeError
syn keyword pythonExceptions UnicodeTranslateError ValueError
syn keyword pythonExceptions ZeroDivisionError
" builtin OS exceptions in Python 3
syn keyword pythonExceptions BlockingIOError BrokenPipeError
syn keyword pythonExceptions ChildProcessError ConnectionAbortedError
syn keyword pythonExceptions ConnectionError ConnectionRefusedError
syn keyword pythonExceptions ConnectionResetError FileExistsError
syn keyword pythonExceptions FileNotFoundError InterruptedError
syn keyword pythonExceptions IsADirectoryError NotADirectoryError
syn keyword pythonExceptions PermissionError ProcessLookupError
syn keyword pythonExceptions RecursionError StopAsyncIteration
syn keyword pythonExceptions TimeoutError
" builtin exceptions deprecated/removed in Python 3
syn keyword pythonExceptions IOError VMSError WindowsError
" builtin warnings
syn keyword pythonExceptions BytesWarning DeprecationWarning FutureWarning
syn keyword pythonExceptions ImportWarning PendingDeprecationWarning
syn keyword pythonExceptions RuntimeWarning SyntaxWarning UnicodeWarning
syn keyword pythonExceptions UserWarning Warning
" builtin warnings in Python 3
syn keyword pythonExceptions ResourceWarning
endif
if exists("python_space_error_highlight")
" trailing whitespace
syn match pythonSpaceError display excludenl "\s\+$"
" mixed tabs and spaces
syn match pythonSpaceError display " \+\t"
syn match pythonSpaceError display "\t\+ "
endif
" Do not spell doctests inside strings.
" Notice that the end of a string, either ''', or """, will end the contained
" doctest too. Thus, we do *not* need to have it as an end pattern.
if !exists("python_no_doctest_highlight")
if !exists("python_no_doctest_code_highlight")
syn region pythonDoctest
\ start="^\s*>>>\s" end="^\s*$"
\ contained contains=ALLBUT,pythonDoctest,pythonFunction,@Spell
syn region pythonDoctestValue
\ start=+^\s*\%(>>>\s\|\.\.\.\s\|"""\|'''\)\@!\S\++ end="$"
\ contained
else
syn region pythonDoctest
\ start="^\s*>>>" end="^\s*$"
\ contained contains=@NoSpell
endif
endif
" Sync at the beginning of class, function, or method definition.
syn sync match pythonSync grouphere NONE "^\%(def\|class\)\s\+\h\w*\s*[(:]"
" The default highlight links. Can be overridden later.
hi def link pythonStatement Statement
hi def link pythonConditional Conditional
hi def link pythonRepeat Repeat
hi def link pythonOperator Operator
hi def link pythonException Exception
hi def link pythonInclude Include
hi def link pythonAsync Statement
hi def link pythonDecorator Define
hi def link pythonDecoratorName Function
hi def link pythonFunction Function
hi def link pythonComment Comment
hi def link pythonTodo Todo
hi def link pythonString String
hi def link pythonRawString String
hi def link pythonQuotes String
hi def link pythonTripleQuotes pythonQuotes
hi def link pythonEscape Special
if !exists("python_no_number_highlight")
hi def link pythonNumber Number
endif
if !exists("python_no_builtin_highlight")
hi def link pythonBuiltin Function
endif
if !exists("python_no_exception_highlight")
hi def link pythonExceptions Structure
endif
if exists("python_space_error_highlight")
hi def link pythonSpaceError Error
endif
if !exists("python_no_doctest_highlight")
hi def link pythonDoctest Special
hi def link pythonDoctestValue Define
endif
let b:current_syntax = "python"
let &cpo = s:cpo_save
unlet s:cpo_save
" vim:set sw=2 sts=2 ts=8 noet:

17
runtime/syntax/quarto.vim Normal file
View File

@ -0,0 +1,17 @@
" Language: Quarto (Markdown with chunks of R, Python and other languages)
" Provisory Maintainer: Jakson Aquino <jalvesaq@gmail.com>
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
" Last Change: Fri Feb 24, 2023 08:26AM
"
" The developers of tools for Quarto maintain Vim runtime files in their
" Github repository and, if required, I will hand over the maintenance of
" this script for them.
runtime syntax/rmd.vim
syn match quartoShortarg /\S\+/ contained
syn keyword quartoShortkey var meta env pagebreak video include contained
syn region quartoShortcode matchgroup=PreProc start='{{< ' end=' >}}' contains=quartoShortkey,quartoShortarg transparent keepend
hi def link quartoShortkey Include
hi def link quartoShortarg String

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: Sun Mar 28, 2021 01:47PM
" Last Change: Thu Nov 17, 2022 10:13PM
" Filenames: *.R *.r *.Rhistory *.Rt
"
" NOTE: The highlighting of R functions might be defined in
@ -65,41 +65,35 @@ if g:r_syntax_hl_roxygen
" roxygen line containing only a roxygen comment marker, optionally followed
" by whitespace is called an empty roxygen line.
syn match rOCommentKey "^\s*#\{1,2}'" contained
syn region rOExamples start="^\s*#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOTag fold
" 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
" First we match all roxygen blocks as containing only a title. In case an
" empty roxygen line ending the title or a tag is found, this will be
" overridden later by the definitions of rOBlock.
syn match rOTitleBlock "\%^\(\s*#\{1,2}' .*\n\)\{1,}" contains=rOCommentKey,rOTitleTag
syn match rOTitleBlock "^\s*\n\(\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 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
syn region rOBlock start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold
syn region rOBlock start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold
syn region rOBlock start="\(\%^\|^\s*\n\)\@<=\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold
" or by a roxygen tag (we match everything starting with @ but not @@ which is used as escape sequence for a literal @).
syn region rOBlock start="\%^\(\s*#\{1,2}' .*\n\)\{-}\s*#\{1,2}' @\(@\)\@!" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold
syn region rOBlock start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-}\s*#\{1,2}' @\(@\)\@!" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold
syn region rOBlock start="\(\%^\|^\s*\n\)\@<=\(\s*#\{1,2}' .*\n\)\{-}\s*#\{1,2}' @\(@\)\@!" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold
" If a block contains an @rdname, @describeIn tag, it may have paragraph breaks, but does not have a title
syn region rOBlockNoTitle start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @rdname" 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}' @rdname" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold
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
syn match rOCommentKey "^\s*#\{1,2}'" contained
syn region rOExamples start="^\s*#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOTag fold
" 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
syn region rOBlockNoTitle start="\(\%^\|^\s*\n\)\@<=\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @rdname" 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
" rOTag list originally generated from the lists that were available in
" https://github.com/klutometis/roxygen/R/rd.R and
@ -245,14 +239,15 @@ syn match rOperator "&"
syn match rOperator '-'
syn match rOperator '\*'
syn match rOperator '+'
if &filetype != "rmd" && &filetype != "rrst"
syn match rOperator "[|!<>^~/:]"
else
if &filetype == "quarto" || &filetype == "rmd" || &filetype == "rrst"
syn match rOperator "[|!<>^~`/:]"
else
syn match rOperator "[|!<>^~/:]"
endif
syn match rOperator "%\{2}\|%\S\{-}%"
syn match rOperator '\([!><]\)\@<=='
syn match rOperator '=='
syn match rOperator '|>'
syn match rOpError '\*\{3}'
syn match rOpError '//'
syn match rOpError '&&&'
@ -318,10 +313,13 @@ if &filetype == "rhelp"
endif
" Type
syn match rType "\\"
syn keyword rType array category character complex double function integer list logical matrix numeric vector data.frame
" Name of object with spaces
if &filetype != "rmd" && &filetype != "rrst"
if &filetype == "rmd" || &filetype == "rrst" || &filetype == "quarto"
syn region rNameWSpace start="`" end="`" contains=rSpaceFun containedin=rmdrChunk
else
syn region rNameWSpace start="`" end="`" contains=rSpaceFun
endif

View File

@ -1,7 +1,7 @@
" markdown Text with R statements
" Language: markdown with R code chunks
" Language: Markdown with chunks of R, Python and other languages
" Maintainer: Jakson Aquino <jalvesaq@gmail.com>
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
" Last Change: Wed Apr 21, 2021 09:55AM
" Last Change: Fri Feb 24, 2023 08:28AM
"
" For highlighting pandoc extensions to markdown like citations and TeX and
" many other advanced features like folding of markdown sections, it is
@ -13,63 +13,120 @@ if exists("b:current_syntax")
finish
endif
let s:cpo_save = &cpo
set cpo&vim
" 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'])
" Don't waste time loading syntax that will be discarded:
let s:save_pandoc_lngs = get(g:, 'pandoc#syntax#codeblocks#embeds#langs', [])
let g:pandoc#syntax#codeblocks#embeds#langs = []
" Step_1: Source pandoc.vim if it is installed:
runtime syntax/pandoc.vim
if exists("b:current_syntax")
" 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
" R chunks will not be highlighted by syntax/markdown because their headers
" follow a non standard pattern: "```{lang" instead of "^```lang".
" Make a copy of g:markdown_fenced_languages to highlight the chunks later:
if exists('g:markdown_fenced_languages')
if !exists('g:rmd_fenced_languages')
let g:rmd_fenced_languages = deepcopy(g:markdown_fenced_languages)
let g:markdown_fenced_languages = []
if hlexists('pandocDelimitedCodeBlock')
syn clear pandocDelimitedCodeBlock
endif
if len(s:save_pandoc_lngs) > 0 && !exists('g:rmd_fenced_languages')
let g:rmd_fenced_languages = deepcopy(s:save_pandoc_lngs)
endif
" Recognize inline R code
syn region rmdrInline matchgroup=rmdInlineDelim start="`r " end="`" contains=@Rmdr containedin=pandocLaTeXRegion,yamlFlowString keepend
else
let g:rmd_fenced_languages = ['r']
" Step_2: Source markdown.vim if pandoc.vim is not installed
" 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)
" R chunks will not be highlighted by syntax/markdown because their headers
" follow a non standard pattern: "```{lang" instead of "^```lang".
" Make a copy of g:markdown_fenced_languages to highlight the chunks later:
if exists('g:markdown_fenced_languages') && !exists('g:rmd_fenced_languages')
let g:rmd_fenced_languages = deepcopy(g:markdown_fenced_languages)
endif
if exists('g:markdown_fenced_languages') && len(g:markdown_fenced_languages) > 0
let s:save_mfl = deepcopy(g:markdown_fenced_languages)
endif
" Don't waste time loading syntax that will be discarded:
let g:markdown_fenced_languages = []
runtime syntax/markdown.vim
if exists('s:save_mfl') > 0
let g:markdown_fenced_languages = deepcopy(s:save_mfl)
unlet s:save_mfl
endif
syn region rmdrInline matchgroup=rmdInlineDelim start="`r " end="`" contains=@Rmdr keepend
" Step_2a: Add highlighting for both YAML and citations which are pandoc
" specific, but also used in Rmd files
" You don't need this if either your markdown/syntax.vim already highlights
" the YAML header or you are writing standard markdown
if g:rmd_syn_hl_yaml
" Basic highlighting of YAML header
syn match rmdYamlFieldTtl /^\s*\zs\w\%(-\|\w\)*\ze:/ contained
syn match rmdYamlFieldTtl /^\s*-\s*\zs\w\%(-\|\w\)*\ze:/ contained
syn region yamlFlowString matchgroup=yamlFlowStringDelimiter start='"' skip='\\"' end='"' contains=yamlEscape,rmdrInline contained
syn region yamlFlowString matchgroup=yamlFlowStringDelimiter start="'" skip="''" end="'" contains=yamlSingleEscape,rmdrInline contained
syn match yamlEscape contained '\\\%([\\"abefnrtv\^0_ NLP\n]\|x\x\x\|u\x\{4}\|U\x\{8}\)'
syn match yamlSingleEscape contained "''"
syn match yamlComment /#.*/ contained
" A second colon is a syntax error, unles within a string or following !expr
syn match yamlColonError /:\s*[^'^"^!]*:/ contained
if &filetype == 'quarto'
syn region pandocYAMLHeader matchgroup=rmdYamlBlockDelim start=/\%(\%^\|\_^\s*\n\)\@<=\_^-\{3}\ze\n.\+/ end=/^---$/ keepend contains=rmdYamlFieldTtl,yamlFlowString,yamlComment,yamlColonError
else
syn region pandocYAMLHeader matchgroup=rmdYamlBlockDelim start=/\%(\%^\|\_^\s*\n\)\@<=\_^-\{3}\ze\n.\+/ end=/^\([-.]\)\1\{2}$/ keepend contains=rmdYamlFieldTtl,yamlFlowString,yamlComment,yamlColonError
endif
hi def link rmdYamlBlockDelim Delimiter
hi def link rmdYamlFieldTtl Identifier
hi def link yamlFlowString String
hi def link yamlComment Comment
hi def link yamlColonError Error
endif
" You don't need this if either your markdown/syntax.vim already highlights
" citations or you are writing standard markdown
if g:rmd_syn_hl_citations
" From vim-pandoc-syntax
" parenthetical citations
syn match pandocPCite /\^\@<!\[[^\[\]]\{-}-\{0,1}@[[:alnum:]_][[:alnum:]à-öø-ÿÀ-ÖØ-ß_:.#$%&\-+?<>~\/]*.\{-}\]/ contains=pandocEmphasis,pandocStrong,pandocLatex,pandocCiteKey,@Spell,pandocAmpersandEscape display
" in-text citations with location
syn match pandocICite /@[[:alnum:]_][[:alnum:]à-öø-ÿÀ-ÖØ-ß_:.#$%&\-+?<>~\/]*\s\[.\{-1,}\]/ contains=pandocCiteKey,@Spell display
" cite keys
syn match pandocCiteKey /\(-\=@[[:alnum:]_][[:alnum:]à-öø-ÿÀ-ÖØ-ß_:.#$%&\-+?<>~\/]*\)/ containedin=pandocPCite,pandocICite contains=@NoSpell display
syn match pandocCiteAnchor /[-@]/ contained containedin=pandocCiteKey display
syn match pandocCiteLocator /[\[\]]/ contained containedin=pandocPCite,pandocICite
hi def link pandocPCite Operator
hi def link pandocICite Operator
hi def link pandocCiteKey Label
hi def link pandocCiteAnchor Operator
hi def link pandocCiteLocator Operator
endif
endif
runtime syntax/markdown.vim
" Step_3: Highlight code blocks.
syn region rmdCodeBlock matchgroup=rmdCodeDelim start="^\s*```\s*{.*}$" matchgroup=rmdCodeDelim end="^\s*```\ze\s*$" keepend
syn region rmdCodeBlock matchgroup=rmdCodeDelim start="^\s*```.+$" matchgroup=rmdCodeDelim end="^```$" keepend
hi link rmdCodeBlock Special
" Now highlight chunks:
syn region knitrBodyOptions start='^#| ' end='$' contained containedin=rComment,pythonComment contains=knitrBodyVar,knitrBodyValue transparent
syn match knitrBodyValue ': \zs.*\ze$' keepend contained containedin=knitrBodyOptions
syn match knitrBodyVar '| \zs\S\{-}\ze:' contained containedin=knitrBodyOptions
let g:rmd_fenced_languages = get(g:, 'rmd_fenced_languages', ['r'])
for s:type in g:rmd_fenced_languages
if s:type =~ '='
let s:ft = substitute(s:type, '.*=', '', '')
@ -81,58 +138,40 @@ 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=@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
exe 'syn match knitrChunkDelim /```\s*{\s*'.s:nm.'/ contained containedin=knitrChunkBrace contains=knitrChunkLabel'
exe 'syn match knitrChunkLabelDelim /```\s*{\s*'.s:nm.',\=\s*[-[:alnum:]]\{-1,}[,}]/ contained containedin=knitrChunkBrace'
syn match knitrChunkDelim /}\s*$/ contained containedin=knitrChunkBrace
exe 'syn match knitrChunkBrace /```\s*{\s*'.s:nm.'.*$/ contained containedin=rmd'.s:nm.'Chunk contains=knitrChunkDelim,knitrChunkLabelDelim,@Rmd'.s:nm
exe 'syn region rmd'.s:nm.'Chunk start="^\s*```\s*{\s*=\?'.s:nm.'\>.*$" matchgroup=rmdCodeDelim end="^\s*```\ze\s*$" keepend contains=knitrChunkBrace,@Rmd'.s:nm
hi link knitrChunkLabel Identifier
hi link knitrChunkDelim rmdCodeDelim
hi link knitrChunkLabelDelim rmdCodeDelim
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
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
endfor
unlet! s:type
" Recognize inline R code
syn region rmdrInline matchgroup=rmdInlineDelim start="`r " end="`" contains=@Rmdr keepend
" Step_4: Highlight code recognized by pandoc but not defined in pandoc.vim yet:
syn match pandocDivBegin '^:::\+ {.\{-}}' contains=pandocHeaderAttr
syn match pandocDivEnd '^:::\+$'
hi def link knitrBodyVar PreProc
hi def link knitrBodyValue Constant
hi def link knitrBodyOptions rComment
hi def link pandocDivBegin Delimiter
hi def link pandocDivEnd Delimiter
hi def link rmdInlineDelim Delimiter
hi def link rmdCodeDelim Delimiter
" You don't need this if either your markdown/syntax.vim already highlights
" the YAML header or you are writing standard markdown
if g:rmd_syn_hl_yaml
" Minimum highlighting of yaml header
syn match rmdYamlFieldTtl /^\s*\zs\w*\ze:/ contained
syn match rmdYamlFieldTtl /^\s*-\s*\zs\w*\ze:/ contained
syn region yamlFlowString matchgroup=yamlFlowStringDelimiter start='"' skip='\\"' end='"' contains=yamlEscape,rmdrInline contained
syn region yamlFlowString matchgroup=yamlFlowStringDelimiter start="'" skip="''" end="'" contains=yamlSingleEscape,rmdrInline contained
syn match yamlEscape contained '\\\%([\\"abefnrtv\^0_ NLP\n]\|x\x\x\|u\x\{4}\|U\x\{8}\)'
syn match yamlSingleEscape contained "''"
syn region pandocYAMLHeader matchgroup=rmdYamlBlockDelim start=/\%(\%^\|\_^\s*\n\)\@<=\_^-\{3}\ze\n.\+/ end=/^\([-.]\)\1\{2}$/ keepend contains=rmdYamlFieldTtl,yamlFlowString
hi def link rmdYamlBlockDelim Delimiter
hi def link rmdYamlFieldTtl Identifier
hi def link yamlFlowString String
if len(s:save_pandoc_lngs)
let g:pandoc#syntax#codeblocks#embeds#langs = s:save_pandoc_lngs
endif
" You don't need this if either your markdown/syntax.vim already highlights
" citations or you are writing standard markdown
if g:rmd_syn_hl_citations
" From vim-pandoc-syntax
" parenthetical citations
syn match pandocPCite /\^\@<!\[[^\[\]]\{-}-\{0,1}@[[:alnum:]_][[:alnum:]à-öø-ÿÀ-ÖØ-ß_:.#$%&\-+?<>~\/]*.\{-}\]/ contains=pandocEmphasis,pandocStrong,pandocLatex,pandocCiteKey,@Spell,pandocAmpersandEscape display
" in-text citations with location
syn match pandocICite /@[[:alnum:]_][[:alnum:]à-öø-ÿÀ-ÖØ-ß_:.#$%&\-+?<>~\/]*\s\[.\{-1,}\]/ contains=pandocCiteKey,@Spell display
" cite keys
syn match pandocCiteKey /\(-\=@[[:alnum:]_][[:alnum:]à-öø-ÿÀ-ÖØ-ß_:.#$%&\-+?<>~\/]*\)/ containedin=pandocPCite,pandocICite contains=@NoSpell display
syn match pandocCiteAnchor /[-@]/ contained containedin=pandocCiteKey display
syn match pandocCiteLocator /[\[\]]/ contained containedin=pandocPCite,pandocICite
hi def link pandocPCite Operator
hi def link pandocICite Operator
hi def link pandocCiteKey Label
hi def link pandocCiteAnchor Operator
hi def link pandocCiteLocator Operator
endif
let b:current_syntax = "rmd"
unlet s:save_pandoc_lngs
let &cpo = s:cpo_save
unlet s:cpo_save
let b:current_syntax = "rmd"
" vim: ts=8 sw=2

View File

@ -2,8 +2,8 @@
" Language: shell (sh) Korn shell (ksh) bash (sh)
" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
" Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int>
" Last Change: Dec 20, 2022
" Version: 205
" Last Change: Feb 11, 2023
" Version: 207
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH
" For options and settings, please use: :help ft-sh-syntax
" This file includes many ideas from Eric Brunet (eric.brunet@ens.fr) and heredoc fixes from Felipe Contreras
@ -166,7 +166,7 @@ if exists("b:is_kornshell") || exists("b:is_bash")
syn cluster shLoopoList add=shForPP
endif
syn cluster shPPSLeftList contains=shAlias,shArithmetic,shCmdParenRegion,shCommandSub,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shHereDoc,shNumber,shOperator,shOption,shPosnParm,shHereString,shRedir,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable
syn cluster shPPSRightList contains=shComment,shDeref,shDerefSimple,shEscape,shPosnParm
syn cluster shPPSRightList contains=shDeref,shDerefSimple,shEscape,shPosnParm
syn cluster shSubShList contains=@shCommandSubList,shCommandSubBQ,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator
syn cluster shTestList contains=shArithmetic,shCharClass,shCommandSub,shCommandSubBQ,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shSpecialDQ,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr
syn cluster shNoZSList contains=shSpecialNoZS
@ -335,7 +335,7 @@ syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.' nextgroup=shComment
" systems too, however, so the following syntax will flag $(..) as
" an Error under /bin/sh. By consensus of vimdev'ers!
if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix")
syn region shCommandSub matchgroup=shCmdSubRegion start="\$(\ze[^(]\|$" skip='\\\\\|\\.' end=")" contains=@shCommandSubList
syn region shCommandSub matchgroup=shCmdSubRegion start="\$(\ze[^(]" skip='\\\\\|\\.' end=")" contains=@shCommandSubList
syn region shArithmetic matchgroup=shArithRegion start="\$((" skip='\\\\\|\\.' end="))" contains=@shArithList
syn region shArithmetic matchgroup=shArithRegion start="\$\[" skip='\\\\\|\\.' end="\]" contains=@shArithList
syn match shSkipInitWS contained "^\s\+"
@ -503,7 +503,6 @@ endif
" ksh: ${.sh.*} variables: {{{1
" ========================================
if exists("b:is_kornshell")
" syn match shDerefVar contained "[.]*" nextgroup=@shDerefVarList
syn match shDerefVar contained "\.\+" nextgroup=@shDerefVarList
endif
@ -548,6 +547,7 @@ syn region shDerefVarArray contained matchgroup=shDeref start="\[" end="]" co
" bash : ${parameter,pattern} Case modification
" bash : ${parameter,,pattern} Case modification
" bash : ${@:start:qty} display command line arguments from start to start+qty-1 (inferred)
" bash : ${parameter@operator} transforms parameter (operator∈[uULqEPARa])
syn cluster shDerefPatternList contains=shDerefPattern,shDerefString
if !exists("g:sh_no_error")
syn match shDerefOpError contained ":[[:punct:]]"
@ -563,6 +563,7 @@ if exists("b:is_bash") || exists("b:is_kornshell") || exists("b:is_posix")
endif
if exists("b:is_bash")
syn match shDerefOp contained "[,^]\{1,2}" nextgroup=@shDerefPatternList
syn match shDerefOp contained "@[uULQEPAKa]"
endif
syn region shDerefString contained matchgroup=shDerefDelim start=+\%(\\\)\@<!'+ end=+'+ contains=shStringSpecial
syn region shDerefString contained matchgroup=shDerefDelim start=+\%(\\\)\@<!"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial