7
|
1 " Vim indent file
|
25880
|
2 " Language: readline configuration file
|
|
3 " Maintainer: Doug Kearns <dougkearns@gmail.com>
|
|
4 " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
|
|
5 " Last Change: 24 Sep 2021
|
7
|
6
|
|
7 if exists("b:did_indent")
|
|
8 finish
|
|
9 endif
|
|
10 let b:did_indent = 1
|
|
11
|
|
12 setlocal indentexpr=GetReadlineIndent()
|
|
13 setlocal indentkeys=!^F,o,O,=$else,=$endif
|
1228
|
14 setlocal nosmartindent
|
7
|
15
|
25880
|
16 let b:undo_indent = "setl inde< indk< si<"
|
|
17
|
7
|
18 if exists("*GetReadlineIndent")
|
|
19 finish
|
|
20 endif
|
|
21
|
|
22 function GetReadlineIndent()
|
|
23 let lnum = prevnonblank(v:lnum - 1)
|
|
24 if lnum == 0
|
|
25 return 0
|
|
26 endif
|
|
27
|
|
28 let ind = indent(lnum)
|
|
29
|
375
|
30 if getline(lnum) =~ '^\s*$\(if\|else\)\>'
|
11160
|
31 let ind = ind + shiftwidth()
|
7
|
32 endif
|
|
33
|
375
|
34 if getline(v:lnum) =~ '^\s*$\(else\|endif\)\>'
|
11160
|
35 let ind = ind - shiftwidth()
|
7
|
36 endif
|
|
37
|
|
38 return ind
|
|
39 endfunction
|