diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-04-27 21:48:38 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-04-27 22:40:39 -0400 |
commit | e612a0a76a5c990220113e76ec6a07fe49c28618 (patch) | |
tree | 0831806a26fe7f5a14f3691745dde2c8cc397041 /runtime/indent | |
parent | d894b3da1e4bc0fbb3baf319ca3071cc1d7b7f6c (diff) | |
download | rneovim-e612a0a76a5c990220113e76ec6a07fe49c28618.tar.gz rneovim-e612a0a76a5c990220113e76ec6a07fe49c28618.tar.bz2 rneovim-e612a0a76a5c990220113e76ec6a07fe49c28618.zip |
vim-patch:d1caa941d876
Update runtime files
https://github.com/vim/vim/commit/d1caa941d876181aae0ebebc6ea954045bf0da24
Cherry-pick error E452 from patch v8.2.0486.
Diffstat (limited to 'runtime/indent')
-rw-r--r-- | runtime/indent/rst.vim | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/runtime/indent/rst.vim b/runtime/indent/rst.vim index c1ef8c9957..a31ad8e080 100644 --- a/runtime/indent/rst.vim +++ b/runtime/indent/rst.vim @@ -1,7 +1,9 @@ " Vim indent file -" Language: reStructuredText Documentation Format -" Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2011-08-03 +" Vim reST indent file +" Language: reStructuredText Documentation Format +" Maintainer: Marshall Ward <marshall.ward@gmail.com> +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2020-03-31 if exists("b:did_indent") finish @@ -18,6 +20,12 @@ 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) @@ -28,6 +36,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 |