blob: 056c20a4e43c22caea21ca00c4ebcc00a81574d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
" Vim indent file
" Language: J
" Maintainer: David Bürgin <676c7473@gmail.com>
" Last Change: 2013-09-21
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal indentexpr=GetJIndent()
setlocal indentkeys-=0{,0},\:,0#
setlocal indentkeys+=0),=case.,=catch.,=catchd.,=catcht.,=do.,=else.,=elseif.,=end.,=fcase.
let b:undo_indent = "setl indk< inde<"
if exists("*GetJIndent")
finish
endif
function GetJIndent()
let prevlnum = prevnonblank(v:lnum-1)
if prevlnum == 0
return 0
endif
let indent = indent(prevlnum)
if getline(prevlnum) =~# '^\s*\%(case\|catch[dt]\=\|do\|else\%(if\)\=\|fcase\|for\%(_\a\k*\)\=\|if\|select\|try\|whil\%(e\|st\)\)\.'
if getline(prevlnum) !~# '\<end\.'
let indent += &shiftwidth
endif
endif
if getline(v:lnum) =~# '^\s*\%(case\|catch[dt]\=\|do\|else\%(if\)\=\|end\|fcase\)\.'
let indent -= &shiftwidth
endif
return indent
endfunction
|