2 " Language: reStructuredText Documentation Format
3 " Maintainer: Nikolai Weibull <now@bitwi.se>
4 " Latest Revision: 2006-12-20
6 if exists("b:did_indent")
11 setlocal indentexpr=GetRSTIndent()
12 setlocal indentkeys=!^F,o,O
13 setlocal nosmartindent
15 if exists("*GetRSTIndent")
19 function GetRSTIndent()
20 let lnum = prevnonblank(v:lnum - 1)
25 let ind = indent(lnum)
26 let line = getline(lnum)
28 if line =~ '^\s*[-*+]\s'
30 elseif line =~ '^\s*\d\+.\s'
31 let ind = ind + matchend(substitute(line, '^\s*', '', ''), '\d\+.\s\+')
34 let line = getline(v:lnum - 1)
38 call search('^\s*\%([-*+]\s\|\d\+.\s\|\.\.\|$\)', 'bW')
39 let line = getline('.')
40 if line =~ '^\s*[-*+]'
42 elseif line =~ '^\s*\d\+\.\s'
43 let ind = ind - matchend(substitute(line, '^\s*', '', ''),
45 elseif line =~ '^\s*\.\.'