[vim/vim] runtime(rst): Sync with development branch (PR #18566)

10 views
Skip to first unread message

Marshall Ward

unread,
11:09 AM (12 hours ago) 11:09 AM
to vim/vim, Subscribed

This PR includes several features which have been in the vim-restructuredtext development repository for a long time, but were never passed along to the main vim repo.

  • Better docstring highlight support (37ff118)
  • Consistent minlines (31f506e)
  • Wider spellcheck support in blocks and directives (89bdfb3)
  • Existing directive indentation is now preserved (dea2fa9)

Bugfixes:

  • Nested directives (21914fe)
  • Nested comments (8ab3ff9)
  • Numeric footnotes (c404b26)
  • Disable escape characters inside of inline literals (f41d61c)
  • Correct evaluation of undo_indent, undo_ftplugin (78150af)

These patches are long overdue, hopefully there won't be any disruption. Although content has been separated by commit and author, let me know if you'd prefer submission in a different format.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/18566

Commit Summary

  • 37ff118 runtime(rst): Fix doctest block syntax
  • 31f506e runtime(rst): Add support for rst_minlines
  • 21914fe runtime(rst): Fix highlights nested in directive body
  • 8ab3ff9 runtime(rst): Correctly end nested comments
  • c404b26 runtime(rst): Recognise numeric footnotes [1] correctly
  • f41d61c runtime(rst): Inline literal escape support
  • 89bdfb3 runtime(rst): Enable spell checking for more syntax constructs
  • 7c463b6 runtime(rst): Style update
  • 78150af runtime(rst): Set b:undo_indent and b:undo_ftplugin variables
  • dea2fa9 runtime(rst): Preserve indentation of directives

File Changes

(3 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18566@github.com>

Christian Brabandt

unread,
12:57 PM (10 hours ago) 12:57 PM
to vim/vim, Subscribed

@chrisbra commented on this pull request.


In runtime/indent/rst.vim:

> @@ -27,7 +27,8 @@ let s:note_pattern = '^\.\. '
 
 function! s:get_paragraph_start()
     let paragraph_mark_start = getpos("'{")[1]
-    return getline(paragraph_mark_start) =~ '\S' ? paragraph_mark_start : paragraph_mark_start + 1
+    return getline(paragraph_mark_start) =~
+        \ '\S' ? paragraph_mark_start : paragraph_mark_start + 1

you are using line-continuation here, so you need to update the cpo setting at the beginning of the file (and reset it at the end of the file)


In runtime/ftplugin/rst.vim:

> @@ -32,6 +32,7 @@ setlocal formatoptions+=tcroql
 
 if exists("g:rst_style") && g:rst_style != 0
     setlocal expandtab shiftwidth=3 softtabstop=3 tabstop=8
+    let b:undo_ftplugin .= " | setlocal softtabstop< shiftwidth< tabstop<"
 endif
 
 if g:rst_fold_enabled != 0 && has('patch-7.3.867')  " Introduced the TextChanged event.

you could potentially drop the check for patch 7.3.867 here.


In runtime/syntax/rst.vim:

>  " 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"

This should be documented at :h ft-rst-syntax


In runtime/ftplugin/rst.vim:

> @@ -32,6 +32,7 @@ setlocal formatoptions+=tcroql
 
 if exists("g:rst_style") && g:rst_style != 0
     setlocal expandtab shiftwidth=3 softtabstop=3 tabstop=8
+    let b:undo_ftplugin .= " | setlocal softtabstop< shiftwidth< tabstop<"
 endif
 
 if g:rst_fold_enabled != 0 && has('patch-7.3.867')  " Introduced the TextChanged event.

Oh and the commit mentions undo_indent, but you are only updating undo_ftplugin ?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18566/review/3332332367@github.com>

Marshall Ward

unread,
1:22 PM (9 hours ago) 1:22 PM
to vim/vim, Push

@marshallward pushed 2 commits.

  • d820629 runtime(rst): Set b:undo_ftplugin variable
  • 9bf3551 runtime(rst): Preserve indentation of directives


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18566/before/dea2fa9ee446ae7f8c56bbb21003a0bff5de5e17/after/9bf3551a006b2a8dd22f2d37960556beaa1deff3@github.com>

Marshall Ward

unread,
1:55 PM (9 hours ago) 1:55 PM
to vim/vim, Push

@marshallward pushed 9 commits.

  • e373d2b runtime(rst): Add support for rst_minlines
  • a3a2c7d runtime(rst): Fix highlights nested in directive body
  • 3cddcbf runtime(rst): Correctly end nested comments
  • 981c783 runtime(rst): Recognise numeric footnotes [1] correctly
  • 2be0a4f runtime(rst): Inline literal escape support
  • b147953 runtime(rst): Enable spell checking for more syntax constructs
  • d2f135a runtime(rst): Style update
  • adc8c89 runtime(rst): Set b:undo_ftplugin variable
  • d4704ff runtime(rst): Preserve indentation of directives

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18566/before/9bf3551a006b2a8dd22f2d37960556beaa1deff3/after/d4704ff4bb6380fdf89bbf2424ecb15042e32300@github.com>

Marshall Ward

unread,
1:56 PM (9 hours ago) 1:56 PM
to vim/vim, Subscribed

@marshallward commented on this pull request.


In runtime/syntax/rst.vim:

>  " 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"

I've added a brief note about the flag in syntax.txt.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18566/review/3332551556@github.com>

Marshall Ward

unread,
1:57 PM (9 hours ago) 1:57 PM
to vim/vim, Subscribed

@marshallward commented on this pull request.


In runtime/ftplugin/rst.vim:

> @@ -32,6 +32,7 @@ setlocal formatoptions+=tcroql
 
 if exists("g:rst_style") && g:rst_style != 0
     setlocal expandtab shiftwidth=3 softtabstop=3 tabstop=8
+    let b:undo_ftplugin .= " | setlocal softtabstop< shiftwidth< tabstop<"
 endif
 
 if g:rst_fold_enabled != 0 && has('patch-7.3.867')  " Introduced the TextChanged event.

Thanks, not sure what happened to undo_indent (I wasn't the author) but I've edited the commit log. I've also removed the version check.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18566/review/3332552999@github.com>

Marshall Ward

unread,
1:57 PM (9 hours ago) 1:57 PM
to vim/vim, Subscribed

@marshallward commented on this pull request.


In runtime/indent/rst.vim:

> @@ -27,7 +27,8 @@ let s:note_pattern = '^\.\. '
 
 function! s:get_paragraph_start()
     let paragraph_mark_start = getpos("'{")[1]
-    return getline(paragraph_mark_start) =~ '\S' ? paragraph_mark_start : paragraph_mark_start + 1
+    return getline(paragraph_mark_start) =~
+        \ '\S' ? paragraph_mark_start : paragraph_mark_start + 1

The cpo rest and state restore has been added.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18566/review/3332554020@github.com>

Christian Brabandt

unread,
2:23 PM (8 hours ago) 2:23 PM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#18566)

thanks


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18566/c3398600178@github.com>

Christian Brabandt

unread,
2:45 PM (8 hours ago) 2:45 PM
to vim/vim, Subscribed

Closed #18566 via 64c8105.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18566/issue_event/20253529731@github.com>

Reply all
Reply to author
Forward
0 new messages