blob: 2e7ba185882041398492e8e669e9970e66cba0ac [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim indent file
2" Language: Eterm configuration file
3" Maintainer: Nikolai Weibull <source@pcppopper.org>
4" URL: http://www.pcppopper.org/vim/indent/pcp/eterm/
5" Latest Revision: 2004-04-25
6" arch-tag: a22a92b1-c59f-4f47-8207-b21db6549b21
7
8" Only load this indent file when no other was loaded.
9if exists("b:did_indent")
10 finish
11endif
12
13let b:did_indent = 1
14
15setlocal indentexpr=GetEtermIndent()
16setlocal indentkeys=!^F,o,O,=end
17
18" Only define the function once.
19if exists("*GetEtermIndent")
20 finish
21endif
22
23function GetEtermIndent()
24 " Find a non-blank line above the current line.
25 let lnum = prevnonblank(v:lnum - 1)
26
27 " Hit the start of the file, use zero indent.
28 if lnum == 0
29 return 0
30 endif
31
32 let line = getline(lnum)
33 let ind = indent(lnum)
34
35 if line =~ '^\s*begin\>'
36 let ind = ind + &sw
37 endif
38
39 let line = getline(v:lnum)
40
41 " Check for closing brace on current line
42 if line =~ '^\s*end\>'
43 let ind = ind - &sw
44 endif
45
46 return ind
47endfunction
48
49" vim: set sts=2 sw=2: