From b8a5504021e0d21310bc603855ac8107828b5759 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Tue, 31 Dec 2019 14:05:09 +0100 Subject: Update --- indent/rst.vim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'indent/rst.vim') diff --git a/indent/rst.vim b/indent/rst.vim index df7287ea..8e228dfe 100644 --- a/indent/rst.vim +++ b/indent/rst.vim @@ -20,6 +20,13 @@ endif let s:itemization_pattern = '^\s*[-*+]\s' let s:enumeration_pattern = '^\s*\%(\d\+\|#\)\.\s\+' +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 +endfunction function GetRSTIndent() let lnum = prevnonblank(v:lnum - 1) @@ -30,6 +37,13 @@ function GetRSTIndent() let ind = indent(lnum) let line = getline(lnum) + let psnum = s:get_paragraph_start() + if psnum != 0 + if getline(psnum) =~ s:note_pattern + let ind = 3 + endif + endif + if line =~ s:itemization_pattern let ind += 2 elseif line =~ s:enumeration_pattern -- cgit v1.2.3