@@ -23,7 +23,6 @@ function! elixir#indent#indent(lnum)
23
23
\' top_of_file',
24
24
\' following_trailing_binary_operator',
25
25
\' starts_with_pipe',
26
- \' starts_with_close_bracket',
27
26
\' starts_with_binary_operator',
28
27
\' inside_block',
29
28
\' starts_with_end',
@@ -221,15 +220,6 @@ function! elixir#indent#handle_starts_with_end(lnum, text, _prev_nb_lnum, _prev_
221
220
endif
222
221
endfunction
223
222
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
-
233
223
function ! elixir#indent#handle_starts_with_binary_operator (lnum, text, prev_nb_lnum, prev_nb_text)
234
224
let binary_operator = ' \%(=\|<>\|>>>\|<=\|||\|+\|\~\~\~\|-\|&&\|<<<\|/\|\^\^\^\|\*\)'
235
225
@@ -474,9 +464,11 @@ function! s:do_handle_fn(fn_start_lnum, _fn_start_col, lnum, text, prev_nb_lnum,
474
464
endif
475
465
endfunction
476
466
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)
478
468
" 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
480
472
let brace_start_text = getline (a: brace_start_lnum )
481
473
let substr = strpart (brace_start_text, a: brace_start_col , len (brace_start_text)-1 )
482
474
let indent_pos = match (substr, ' \S' )
@@ -490,12 +482,18 @@ function! s:do_handle_square_brace(brace_start_lnum, brace_start_col, _lnum, _te
490
482
end
491
483
endfunction
492
484
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
495
491
endfunction
496
492
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
499
497
if s: ends_with (a: prev_nb_text , ' (' , a: prev_nb_lnum )
500
498
return indent (a: prev_nb_lnum ) + s: sw ()
501
499
elseif a: paren_start_lnum == a: prev_nb_lnum
0 commit comments