Mercurial > vim
comparison runtime/indent/rst.vim @ 375:f14cbd913415 v7.0097
updated for version 7.0097
author | vimboss |
---|---|
date | Wed, 29 Jun 2005 22:40:58 +0000 |
parents | 3fc0f57ecb91 |
children | 1f3b1021f002 |
comparison
equal
deleted
inserted
replaced
374:575dacb554d8 | 375:f14cbd913415 |
---|---|
1 " Vim indent file | 1 " Vim indent file |
2 " Language: reStructuredText Documentation Format | 2 " Language: reStructuredText Documentation Format |
3 " Maintainer: Nikolai Weibull <source@pcppopper.org> | 3 " Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se> |
4 " URL: http://www.pcppopper.org/vim/indent/pcp/rst/ | 4 " Latest Revision: 2005-06-29 |
5 " Latest Revision: 2004-04-25 | |
6 " arch-tag: 3fe10f75-24d0-4d94-a924-0ce945958104 | |
7 | 5 |
8 " Only load this indent file when no other was loaded. | |
9 if exists("b:did_indent") | 6 if exists("b:did_indent") |
10 finish | 7 finish |
11 endif | 8 endif |
12 | |
13 let b:did_indent = 1 | 9 let b:did_indent = 1 |
14 | 10 |
15 setlocal indentexpr=GetRSTIndent() | 11 setlocal indentexpr=GetRSTIndent() |
16 setlocal indentkeys-=:,0# indentkeys-=e | 12 setlocal indentkeys=!^F,o,O |
17 | 13 |
18 " Only define the function once. | |
19 if exists("*GetRSTIndent") | 14 if exists("*GetRSTIndent") |
20 finish | 15 finish |
21 endif | 16 endif |
22 | 17 |
23 function GetRSTIndent() | 18 function GetRSTIndent() |
24 let lnum = prevnonblank(v:lnum - 1) | 19 let lnum = prevnonblank(v:lnum - 1) |
25 | |
26 if lnum == 0 | 20 if lnum == 0 |
27 return 0 | 21 return 0 |
28 endif | 22 endif |
29 | 23 |
30 let ind = indent(lnum) | 24 let ind = indent(lnum) |
44 let line = getline('.') | 38 let line = getline('.') |
45 if line =~ '^\s*[-*+]' | 39 if line =~ '^\s*[-*+]' |
46 let ind = ind - 2 | 40 let ind = ind - 2 |
47 elseif line =~ '^\s*\d\+\.\s' | 41 elseif line =~ '^\s*\d\+\.\s' |
48 let ind = ind - matchend(substitute(line, '^\s*', '', ''), | 42 let ind = ind - matchend(substitute(line, '^\s*', '', ''), |
49 \ '\d\+\.\s\+') | 43 \ '\d\+\.\s\+') |
50 elseif line =~ '^\s*\.\.' | 44 elseif line =~ '^\s*\.\.' |
51 let ind = ind - 3 | 45 let ind = ind - 3 |
52 else | 46 else |
53 let ind = ind | 47 let ind = ind |
54 endif | 48 endif |
55 endif | 49 endif |
56 | 50 |
57 return ind | 51 return ind |
58 endfunction | 52 endfunction |
59 | |
60 " vim: set sts=2 sw=2: |