On Mi, 14 Apr 2021, Friedrich Romstedt wrote:

> Hi,
> 
> Am Fr., 7. Aug. 2020 um 15:18 Uhr schrieb Christian Brabandt
> <cbli...@256bit.org>:
> >
> > I am not sure I understand the problem correctly. It sounds like you are
> > at one point just loading the syntax file, while when opening a proper
> > rst file, Vim will also set the filetype (e.g. set some options and also
> > sets indenting options).
> >
> > Anyhow, it would actually help to see some specific examples of what
> > works and what you expect. Please also have a look at the existing rst
> > filetype as well as the indent plugin). Perhaps you can already disable
> > any options that you do not like.
> 
> Yesterday I uploaded an asciinema cast regarding my issue:
> https://asciinema.org/a/406969.  It illustrates the behaviour I am
> referring to by examples in-line.

I looked into your last uploaded file. It looks like the behaviour is 
hard coded in the indent script, so CC'ing the indent script maintainer.

,----[ $VIMRUNTIME/indent/rst.vim ]-
| function GetRSTIndent()
|   ...
|   let psnum = s:get_paragraph_start()
|   if psnum != 0
|       if getline(psnum) =~ s:note_pattern
|           let ind = 3
|       endif
|   endif
`----

So it is hard coded to be three. I think a better approach would be the 
following patch:

diff --git a/runtime/indent/rst.vim b/runtime/indent/rst.vim
index a31ad8e08..64db170d8 100644
--- a/runtime/indent/rst.vim
+++ b/runtime/indent/rst.vim
@@ -38,9 +38,13 @@ function GetRSTIndent()

   let psnum = s:get_paragraph_start()
   if psnum != 0
-      if getline(psnum) =~ s:note_pattern
-          let ind = 3
+    if getline(psnum) =~ s:note_pattern
+      " return the indent after the first 2 leading '.'
+      let ind = match(getline(psnum), s:note_pattern .. '*\zs\S')
+      if ind < 3
+        let ind = 3
       endif
+    endif
   endif

   if line =~ s:itemization_pattern

Best,
Christian
-- 
Die Katholiken Terrorisieren das Land mit einer Auffassung vom Wesen
der Ehe, die die ihre ist und die uns nichts angeht.
                -- Kurt Tucholsky

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20210416101112.GI2222154%40256bit.org.

Reply via email to