neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 7455c5ce88c4c3ee7ddd3ea8975fafec310d5a9b
parent fc74b9fb34900dfbeccf5e702d98af66d3e1debf
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Tue, 14 Oct 2025 10:41:51 +0800

vim-patch:0940465: runtime(rst): Fix doctest block syntax

A doctest block usually spans multiple lines, e.g.

>>> print('this is a Doctest block')
this is a Doctest block

Remove ``oneline`` argument to syntax region as this requirement is not
met.  Consequently, also remove ``display`` as the prerequisite (the
syntax region is on a single line) is no longer met.

----

Recognise '>>>' inside doctest blocks

Recognise subsequent '>>>' prompts in doctest blocks, e.g.

>>> print('this is a Doctest block')
this is a Doctest block
>>> print('this is a second Doctest block')
this is a second Doctest block
A doctest block usually spans multiple lines, e.g.

>>> print('this is a Doctest block')
this is a Doctest block

related: vim/vim#18566

https://github.com/vim/vim/commit/0940465866486db47baa1fe85ebefb6e6fe54612

Co-authored-by: Kirk Roemer <91125534+kirk-roemer@users.noreply.github.com>

Diffstat:
Mruntime/syntax/rst.vim | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/runtime/syntax/rst.vim b/runtime/syntax/rst.vim @@ -28,8 +28,11 @@ syn region rstQuotedLiteralBlock matchgroup=rstDelimiter \ start="::\_s*\n\ze\z([!\"#$%&'()*+,-./:;<=>?@[\]^_`{|}~]\)" \ end='^\z1\@!' contains=@NoSpell -syn region rstDoctestBlock oneline display matchgroup=rstDelimiter +syn region rstDoctestBlock matchgroup=rstDoctestBlockPrompt \ start='^>>>\s' end='^$' + \ contains=rstDoctestBlockPrompt + +syn match rstDoctestBlockPrompt contained '^>>>\s' syn region rstTable transparent start='^\n\s*+[-=+]\+' end='^$' \ contains=rstTableLines,@rstCruft @@ -256,6 +259,7 @@ hi def link rstTransition rstSections hi def link rstLiteralBlock String hi def link rstQuotedLiteralBlock String hi def link rstDoctestBlock PreProc +hi def link rstDoctestBlockPrompt rstDelimiter hi def link rstTableLines rstDelimiter hi def link rstSimpleTableLines rstTableLines hi def link rstExplicitMarkup rstDirective