@@ -23,7 +23,6 @@ function! elixir#indent#indent(lnum)
2323 \' top_of_file',
2424 \' following_trailing_binary_operator',
2525 \' starts_with_pipe',
26- \' starts_with_close_bracket',
2726 \' starts_with_binary_operator',
2827 \' inside_block',
2928 \' starts_with_end',
@@ -221,15 +220,6 @@ function! elixir#indent#handle_starts_with_end(lnum, text, _prev_nb_lnum, _prev_
221220 endif
222221endfunction
223222
224- function ! elixir#indent#handle_starts_with_close_bracket (lnum, text, _prev_nb_lnum, _prev_nb_text)
225- if s: starts_with (a: text , ' \%(\]\|}\|)\)' , a: lnum )
226- let pair_lnum = searchpair (' \%(\[\|{\|(\)' , ' ' , ' \%(\]\|}\|)\)' , ' bnW' , " line('.') == " . line (' .' ) . " || elixir#indent#searchpair_back_skip()" )
227- return indent (pair_lnum)
228- else
229- return -1
230- endif
231- endfunction
232-
233223function ! elixir#indent#handle_starts_with_binary_operator (lnum, text, prev_nb_lnum, prev_nb_text)
234224 let binary_operator = ' \%(=\|<>\|>>>\|<=\|||\|+\|\~\~\~\|-\|&&\|<<<\|/\|\^\^\^\|\*\)'
235225
@@ -474,9 +464,11 @@ function! s:do_handle_fn(fn_start_lnum, _fn_start_col, lnum, text, prev_nb_lnum,
474464 endif
475465endfunction
476466
477- function ! s: do_handle_square_brace (brace_start_lnum, brace_start_col, _lnum, _text , _prev_nb_lnum, _prev_nb_text)
467+ function ! s: do_handle_square_brace (brace_start_lnum, brace_start_col, lnum, text , _prev_nb_lnum, _prev_nb_text)
478468 " If in list...
479- if a: brace_start_lnum != 0 || a: brace_start_col != 0
469+ if s: starts_with (a: text , ' ]' , a: lnum )
470+ return indent (a: brace_start_lnum )
471+ elseif a: brace_start_lnum != 0 || a: brace_start_col != 0
480472 let brace_start_text = getline (a: brace_start_lnum )
481473 let substr = strpart (brace_start_text, a: brace_start_col , len (brace_start_text)-1 )
482474 let indent_pos = match (substr, ' \S' )
@@ -490,12 +482,18 @@ function! s:do_handle_square_brace(brace_start_lnum, brace_start_col, _lnum, _te
490482 end
491483endfunction
492484
493- function ! s: do_handle_curly_brace (brace_start_lnum, _brace_start_col, _lnum, _text, _prev_nb_lnum, _prev_nb_text)
494- return indent (a: brace_start_lnum ) + s: sw ()
485+ function ! s: do_handle_curly_brace (brace_start_lnum, _brace_start_col, lnum, text, _prev_nb_lnum, _prev_nb_text)
486+ if s: starts_with (a: text , ' }' , a: lnum )
487+ return indent (a: brace_start_lnum )
488+ else
489+ return indent (a: brace_start_lnum ) + s: sw ()
490+ endif
495491endfunction
496492
497- function ! s: do_handle_parens (paren_start_lnum, paren_start_col, _lnum, _text, prev_nb_lnum, prev_nb_text)
498- if a: paren_start_lnum
493+ function ! s: do_handle_parens (paren_start_lnum, paren_start_col, lnum, text, prev_nb_lnum, prev_nb_text)
494+ if s: starts_with (a: text , ' )' , a: lnum )
495+ return indent (a: paren_start_lnum )
496+ elseif a: paren_start_lnum
499497 if s: ends_with (a: prev_nb_text , ' (' , a: prev_nb_lnum )
500498 return indent (a: prev_nb_lnum ) + s: sw ()
501499 elseif a: paren_start_lnum == a: prev_nb_lnum
0 commit comments