7
|
1 " Vim indent file
|
856
|
2 " Language: readline configuration file
|
839
|
3 " Maintainer: Nikolai Weibull <now@bitwi.se>
|
|
4 " Latest Revision: 2006-04-19
|
7
|
5
|
|
6 if exists("b:did_indent")
|
|
7 finish
|
|
8 endif
|
|
9 let b:did_indent = 1
|
|
10
|
|
11 setlocal indentexpr=GetReadlineIndent()
|
|
12 setlocal indentkeys=!^F,o,O,=$else,=$endif
|
|
13
|
|
14 if exists("*GetReadlineIndent")
|
|
15 finish
|
|
16 endif
|
|
17
|
|
18 function GetReadlineIndent()
|
|
19 let lnum = prevnonblank(v:lnum - 1)
|
|
20 if lnum == 0
|
|
21 return 0
|
|
22 endif
|
|
23
|
|
24 let ind = indent(lnum)
|
|
25
|
375
|
26 if getline(lnum) =~ '^\s*$\(if\|else\)\>'
|
7
|
27 let ind = ind + &sw
|
|
28 endif
|
|
29
|
375
|
30 if getline(v:lnum) =~ '^\s*$\(else\|endif\)\>'
|
7
|
31 let ind = ind - &sw
|
|
32 endif
|
|
33
|
|
34 return ind
|
|
35 endfunction
|