Mercurial > vim
comparison runtime/indent/rst.vim @ 19968:1908e92b02fd
Update runtime files
Commit: https://github.com/vim/vim/commit/d1caa941d876181aae0ebebc6ea954045bf0da24
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Apr 10 22:10:56 2020 +0200
Update runtime files
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 10 Apr 2020 22:15:05 +0200 |
parents | 1218c5353e2b |
children | 5c220cf30f1f |
comparison
equal
deleted
inserted
replaced
19967:f11b9ed4f9e1 | 19968:1908e92b02fd |
---|---|
1 " Vim indent file | 1 " Vim indent file |
2 " Language: reStructuredText Documentation Format | 2 " Vim reST indent file |
3 " Previous Maintainer: Nikolai Weibull <now@bitwi.se> | 3 " Language: reStructuredText Documentation Format |
4 " Latest Revision: 2011-08-03 | 4 " Maintainer: Marshall Ward <marshall.ward@gmail.com> |
5 " Previous Maintainer: Nikolai Weibull <now@bitwi.se> | |
6 " Latest Revision: 2020-03-31 | |
5 | 7 |
6 if exists("b:did_indent") | 8 if exists("b:did_indent") |
7 finish | 9 finish |
8 endif | 10 endif |
9 let b:did_indent = 1 | 11 let b:did_indent = 1 |
16 finish | 18 finish |
17 endif | 19 endif |
18 | 20 |
19 let s:itemization_pattern = '^\s*[-*+]\s' | 21 let s:itemization_pattern = '^\s*[-*+]\s' |
20 let s:enumeration_pattern = '^\s*\%(\d\+\|#\)\.\s\+' | 22 let s:enumeration_pattern = '^\s*\%(\d\+\|#\)\.\s\+' |
23 let s:note_pattern = '^\.\. ' | |
24 | |
25 function! s:get_paragraph_start() | |
26 let paragraph_mark_start = getpos("'{")[1] | |
27 return getline(paragraph_mark_start) =~ '\S' ? paragraph_mark_start : paragraph_mark_start + 1 | |
28 endfunction | |
21 | 29 |
22 function GetRSTIndent() | 30 function GetRSTIndent() |
23 let lnum = prevnonblank(v:lnum - 1) | 31 let lnum = prevnonblank(v:lnum - 1) |
24 if lnum == 0 | 32 if lnum == 0 |
25 return 0 | 33 return 0 |
26 endif | 34 endif |
27 | 35 |
28 let ind = indent(lnum) | 36 let ind = indent(lnum) |
29 let line = getline(lnum) | 37 let line = getline(lnum) |
38 | |
39 let psnum = s:get_paragraph_start() | |
40 if psnum != 0 | |
41 if getline(psnum) =~ s:note_pattern | |
42 let ind = 3 | |
43 endif | |
44 endif | |
30 | 45 |
31 if line =~ s:itemization_pattern | 46 if line =~ s:itemization_pattern |
32 let ind += 2 | 47 let ind += 2 |
33 elseif line =~ s:enumeration_pattern | 48 elseif line =~ s:enumeration_pattern |
34 let ind += matchend(line, s:enumeration_pattern) | 49 let ind += matchend(line, s:enumeration_pattern) |