[PATCH] runtime(rst): Add support for rst_minlines variable

24 views
Skip to first unread message

Dragan Simic

unread,
Mar 6, 2025, 12:52:16 PMMar 6
to vim...@vim.org, vim...@googlegroups.com
Following the approach used in other syntax definitions, add support for
defining the "syntax sync minlines=..." values for rst files in the users'
~/.vimrc files, to allow the users to adjust that value in case syntax
highlighting stops working for some of the files they edit.

Signed-off-by: Dragan Simic <dsi...@manjaro.org>
---

Notes:
It seems that patches like this one should be submitted through the
respective GitHub project pages. Though, I'm unable to use GitHub,
so I'd appreciate if this patch could be picked up from the vim-dev
mailing list by the respective project maintainer.

runtime/syntax/rst.vim | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/runtime/syntax/rst.vim b/runtime/syntax/rst.vim
index a90c90be21a2..b4f50f36f4a3 100644
--- a/runtime/syntax/rst.vim
+++ b/runtime/syntax/rst.vim
@@ -3,7 +3,7 @@
" Maintainer: Marshall Ward <marsha...@gmail.com>
" Previous Maintainer: Nikolai Weibull <n...@bitwi.se>
" Website: https://github.com/marshallward/vim-restructuredtext
-" Latest Revision: 2020-03-31
+" Latest Revision: 2025-03-06

if exists("b:current_syntax")
finish
@@ -246,8 +246,7 @@ endfor
" Enable top level spell checking
syntax spell toplevel

-" TODO: Use better syncing.
-syn sync minlines=50 linebreaks=2
+exe "syn sync minlines=" . get(g:, 'rst_minlines', 50) . " linebreaks=2"

hi def link rstTodo Todo
hi def link rstComment Comment

Christian Brabandt

unread,
Mar 6, 2025, 4:45:25 PMMar 6
to vim...@googlegroups.com, dsi...@manjaro.org

On Thu, 06 Mar 2025, 'Dragan Simic' via vim_dev wrote:

> Following the approach used in other syntax definitions, add support for
> defining the "syntax sync minlines=..." values for rst files in the users'
> ~/.vimrc files, to allow the users to adjust that value in case syntax
> highlighting stops working for some of the files they edit.

Thanks, I redirected this to
https://github.com/marshallward/vim-restructuredtext/issues/76

I am not sure if that repo is still actively maintained, so if there is
no activity within the next month, feel free to nudge me to include this
directly into Vim.

Thanks,
Chris
Mit freundlichen Grüßen
Christian
--
Nothing is so firmly believed as that which we least know.
-- Michel de Montaigne

Dragan Simic

unread,
Mar 6, 2025, 5:17:56 PMMar 6
to vim...@googlegroups.com, dsi...@manjaro.org
Hello Christian,

On 2025-03-06 22:45, Christian Brabandt wrote:
> On Thu, 06 Mar 2025, 'Dragan Simic' via vim_dev wrote:
>
>> Following the approach used in other syntax definitions, add support
>> for
>> defining the "syntax sync minlines=..." values for rst files in the
>> users'
>> ~/.vimrc files, to allow the users to adjust that value in case syntax
>> highlighting stops working for some of the files they edit.
>
> Thanks, I redirected this to
> https://github.com/marshallward/vim-restructuredtext/issues/76
>
> I am not sure if that repo is still actively maintained, so if there is
> no activity within the next month, feel free to nudge me to include
> this
> directly into Vim.

Great, thanks! I'll keep an eye on it, and will let you know.

Maxim Kim

unread,
Mar 6, 2025, 5:45:40 PMMar 6
to vim_dev
It would also need an entry in a doc, right? Like in :h g:markdown_minlines

Christian Brabandt

unread,
Mar 7, 2025, 2:15:36 AMMar 7
to vim...@googlegroups.com

On Thu, 06 Mar 2025, Maxim Kim wrote:

> It would also need an entry in a doc, right? Like in :h g:markdown_minlines

Yes it would and I mentioned it in the PR I created. Unfortunately, the
upstream repo doesn't contain docs, so we will have to add it once it is
synced back with the Vim repo.

Thanks,
Christian
--
It was one time too many
One word too few
It was all too much for me and you
There was one way to go
Nothing more we could do
One time too many
One word too few
-- Meredith Tanner

Dragan Simic

unread,
Mar 7, 2025, 2:23:36 AMMar 7
to vim...@googlegroups.com
Please see the attached patch as an attempt to provide a short addition
to the Vim documentation, which describes the rst_minlines variable.
I'm
sorry for not including that already in my first patch.
0001-runtime-rst-Add-documentation-for-rst_minlines-variable.patch

Marshall Ward

unread,
Mar 7, 2025, 7:21:18 AMMar 7
to vim_dev
Dragan, I have added your patch to the development PR.  Thanks very much for noting this issue.

Several outstanding highlight issues have discouraged me from sending any updates - including some that may have prompted the change to minlines - but I have started to work on this again and I hope this can get into the mainline soon. But if progress slows then I would not object to an immediate change to the syntax file.

Dragan Simic

unread,
Mar 7, 2025, 7:43:44 AMMar 7
to vim...@googlegroups.com, Maxim Kim
Hello Maxim,

On 2025-03-06 23:45, Maxim Kim wrote:
> It would also need an entry in a doc, right? Like in :h
> g:markdown_minlines

Indeed, and I sent yesterday another patch (as an attachment
to a reply in this thread) that adds a brief description of
the rst_minlines variable to the documentation.

I'm not sure has the patch reached the mailing list yet, though.

Dragan Simic

unread,
Mar 7, 2025, 7:44:48 AMMar 7
to vim...@googlegroups.com, Marshall Ward
Hello Marshall,

On 2025-03-07 13:21, Marshall Ward wrote:
> Dragan, I have added your patch to the development PR. Thanks very
> much for noting this issue.

Great, thanks a lot!
Reply all
Reply to author
Forward
0 new messages