@@ -3,7 +3,7 @@
3" Based on haskell indentation by motemen <motemen@gmail.com>
3" Based on haskell indentation by motemen <motemen@gmail.com>
5" author: raichoo (raichoo@googlemail.com)
5" author: raichoo (raichoo@googlemail.com)
6−" date: Oct 19 2012
6+" date: Oct 31 2012
8" Modify g:idris_indent_if and g:idris_indent_case to
8" Modify g:idris_indent_if and g:idris_indent_case to
9" change indentation for `if'(default 3) and `case'(default 5).
9" change indentation for `if'(default 3) and `case'(default 5).
@@ -49,7 +49,7 @@ if !exists('g:idris_indent_do')
51setlocal indentexpr=GetIdrisIndent()
51setlocal indentexpr=GetIdrisIndent()
52−setlocal indentkeys=!^F,o,O
52+setlocal indentkeys=!^F,o,O,}
54function! GetIdrisIndent()
54function! GetIdrisIndent()
55 let prevline = getline(v:lnum - 1)
55 let prevline = getline(v:lnum - 1)
@@ -63,7 +63,7 @@ function! GetIdrisIndent()
66− if prevline =~ '[{([]\s*$'
66+ if prevline =~ '[{([][^})\]]\+$'
67 return match(prevline, '[{([]')
67 return match(prevline, '[{([]')
@@ -83,7 +83,7 @@ function! GetIdrisIndent()
86− if prevline =~ '\(where\|do\|=\)\s*$'
86+ if prevline =~ '\(where\|do\|=\|[{([]\)\s*$'
87 return match(prevline, '\S') + &shiftwidth
87 return match(prevline, '\S') + &shiftwidth
@@ -115,5 +115,15 @@ function! GetIdrisIndent()
115 return match(prevline, '\(using\|parameters\)') + &shiftwidth
115 return match(prevline, '\(using\|parameters\)') + &shiftwidth
118+ if prevline =~ '^\s*mutual\s*$'
119+ return match(prevline, 'mutual') + &shiftwidth
122+ let line = getline(v:lnum)
124+ if (line =~ '^\s*}\s*' && prevline !~ '^\s*;')
125+ return match(prevline, '\S') - &shiftwidth
118 return match(prevline, '\S')
128 return match(prevline, '\S')
119endfunction
129endfunction