on master help sign in
improved {[( handling
commitb0ce16c281847f93325935d43a3e9f76551c65f1 authorraichoo <raichoo@googlemail.com> dateWed 31 Oct 2012, 10:47 (14 years ago) parent53024f8
1 file changed+9−3
contribs/tool-support/vim/indent/idris.vim+9−3
contribs/tool-support/vim/indent/idris.vim+9−3
@@ -49,7 +49,7 @@ if !exists('g:idris_indent_do')
4949endif
5050
5151setlocal indentexpr=GetIdrisIndent()
52−setlocal indentkeys=!^F,o,O
52+setlocal indentkeys=!^F,o,O,}
5353
5454function! GetIdrisIndent()
5555 let prevline = getline(v:lnum - 1)
@@ -63,7 +63,7 @@ function! GetIdrisIndent()
6363 endif
6464 endif
6565
66− if prevline =~ '[{([]\s*$'
66+ if prevline =~ '[{([][^})\]]\+$'
6767 return match(prevline, '[{([]')
6868 endif
6969
@@ -83,7 +83,7 @@ function! GetIdrisIndent()
8383 endif
8484 endif
8585
86− if prevline =~ '\(where\|do\|=\)\s*$'
86+ if prevline =~ '\(where\|do\|=\|[{([]\)\s*$'
8787 return match(prevline, '\S') + &shiftwidth
8888 endif
8989
@@ -119,5 +119,11 @@ function! GetIdrisIndent()
119119 return match(prevline, 'mutual') + &shiftwidth
120120 endif
121121
122+ let line = getline(v:lnum)
123+
124+ if (line =~ '^\s*}\s*' && prevline !~ '^\s*;')
125+ return match(prevline, '\S') - &shiftwidth
126+ endif
127+
122128 return match(prevline, '\S')
123129endfunction