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