@@ -1,139 +0,0 @@
1−" indentation for idris (idris-lang.org)
3−" Based on haskell indentation by motemen <motemen@gmail.com>
5−" author: raichoo (raichoo@googlemail.com)
8−" Modify g:idris_indent_if and g:idris_indent_case to
9−" change indentation for `if'(default 3) and `case'(default 5).
10−" Example (in .vimrc):
11−" > let g:idris_indent_if = 2
13−if exists('b:did_indent')
19−if !exists('g:idris_indent_if')
23− let g:idris_indent_if = 3
26−if !exists('g:idris_indent_case')
29− " >>>>>(y::ys) -> ...
30− let g:idris_indent_case = 5
33−if !exists('g:idris_indent_let')
36− let g:idris_indent_let = 4
39−if !exists('g:idris_indent_rewrite')
40− " rewrite prf in expr
42− let g:idris_indent_rewrite = 8
45−if !exists('g:idris_indent_where')
46− " where f : Nat -> Nat
48− let g:idris_indent_where = 6
51−if !exists('g:idris_indent_do')
54− let g:idris_indent_do = 3
57−setlocal indentexpr=GetIdrisIndent()
58−setlocal indentkeys=!^F,o,O,}
60−function! GetIdrisIndent()
61− let prevline = getline(v:lnum - 1)
63− if prevline =~ '[!#$%&*+./<>?@\\^|~-]\s*$'
64− let s = match(prevline, '[:=]')
68− return match(prevline, '\S')
72− if prevline =~ '[{([][^})\]]\+$'
73− return match(prevline, '[{([]')
76− if prevline =~ '\<let\>\s\+.\+\<in\>\s*$'
77− return match(prevline, 'let') + g:idris_indent_let
80− if prevline =~ '\<rewrite\>\s\+.\+\<in\>\s*$'
81− return match(prevline, 'rewrite') + g:idris_indent_rewrite
84− if prevline !~ '\<else\>'
85− let s = match(prevline, '\<if\>.*\&.*\zs\<then\>')
90− let s = match(prevline, '\<if\>')
92− return s + g:idris_indent_if
96− if prevline =~ '\(\<where\>\|\<do\>\|=\|[{([]\)\s*$'
97− return match(prevline, '\S') + &shiftwidth
100− if prevline =~ '\<where\>\s\+\S\+.*$'
101− return match(prevline, '\<where\>') + g:idris_indent_where
104− if prevline =~ '\<do\>\s\+\S\+.*$'
105− return match(prevline, '\<do\>') + g:idris_indent_do
108− if prevline =~ '^\s*\<\(co\)\?data\>\s\+[^=]\+\s\+=\s\+\S\+.*$'
109− return match(prevline, '=')
112− if prevline =~ '\<with\>\s\+([^)]*)\s*$'
113− return match(prevline, '\S') + &shiftwidth
116− if prevline =~ '\<case\>\s\+.\+\<of\>\s*$'
117− return match(prevline, 'case') + g:idris_indent_case
120− if prevline =~ '^\s*\(\<namespace\>\|\<\(co\)\?data\>\)\s\+\S\+\s*$'
121− return match(prevline, '\(\<namespace\>\|\<\(co\)\?data\>\)') + &shiftwidth
124− if prevline =~ '^\s*\(\<using\>\|\<parameters\>\)\s*([^(]*)\s*$'
125− return match(prevline, '\(\<using\>\|\<parameters\>\)') + &shiftwidth
128− if prevline =~ '^\s*\<mutual\>\s*$'
129− return match(prevline, '\<mutual\>') + &shiftwidth
132− let line = getline(v:lnum)
134− if (line =~ '^\s*}\s*' && prevline !~ '^\s*;')
135− return match(prevline, '\S') - &shiftwidth
138− return match(prevline, '\S')