on master help sign in
improved {[( handling
b0ce16craichoo
contribs/tool-support/vim/indent/idris.vim+9−3
@@ -49,7 +49,7 @@ if !exists('g:idris_indent_do')
49endif
49endif
50
50
51setlocal indentexpr=GetIdrisIndent()
51setlocal indentexpr=GetIdrisIndent()
52−setlocal indentkeys=!^F,o,O
52+setlocal indentkeys=!^F,o,O,}
53
53
54function! GetIdrisIndent()
54function! GetIdrisIndent()
55 let prevline = getline(v:lnum - 1)
55 let prevline = getline(v:lnum - 1)
@@ -63,7 +63,7 @@ function! GetIdrisIndent()
63 endif
63 endif
64 endif
64 endif
65
65
66− if prevline =~ '[{([]\s*$'
66+ if prevline =~ '[{([][^})\]]\+$'
67 return match(prevline, '[{([]')
67 return match(prevline, '[{([]')
68 endif
68 endif
69
69
@@ -83,7 +83,7 @@ function! GetIdrisIndent()
83 endif
83 endif
84 endif
84 endif
85
85
86− if prevline =~ '\(where\|do\|=\)\s*$'
86+ if prevline =~ '\(where\|do\|=\|[{([]\)\s*$'
87 return match(prevline, '\S') + &shiftwidth
87 return match(prevline, '\S') + &shiftwidth
88 endif
88 endif
89
89
@@ -119,5 +119,11 @@ function! GetIdrisIndent()
119 return match(prevline, 'mutual') + &shiftwidth
119 return match(prevline, 'mutual') + &shiftwidth
120 endif
120 endif
121
121
122+ let line = getline(v:lnum)
123+
124+ if (line =~ '^\s*}\s*' && prevline !~ '^\s*;')
125+ return match(prevline, '\S') - &shiftwidth
126+ endif
127+
122 return match(prevline, '\S')
128 return match(prevline, '\S')
123endfunction
129endfunction