Skip to content

Commit 33833cc

Browse files
authored
allow for line breaks before blocks (#575)
``` if () a=b ```
1 parent 13610e6 commit 33833cc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

indent/javascript.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ function s:Onescope(lnum,text,add)
7373
return a:text =~ '\%(\<else\|\<do\|=>' . (a:add ? '\|try\|finally' : '' ) . '\)\C' . s:line_term ||
7474
\ (cursor(a:lnum, match(a:text, ')' . s:line_term)) > -1 &&
7575
\ s:lookForParens('(', ')', 'cbW', 100) > 0 &&
76-
\ cursor(line('.'),match( ' ' . strpart(getline(line('.')),0,col('.') - 1),
77-
\ (a:add ? '\K\k*' :
78-
\ '\<\%(else\|for\%(\s+each\)\=\|function\*\=\%(\s\+\K\k*\)\=\|if\|let\|switch\|while\|with\)\C') . s:line_term)) > -1) &&
76+
\ search((a:add ? '\K\k*' :
77+
\ '\<\%(else\|for\%(\s+each\)\=\|function\*\=\%(\s\+\K\k*\)\=\|if\|let\|switch\|while\|with\)\C') .
78+
\ '\_s*\%#','bW')) &&
7979
\ (a:add || (expand("<cword>") == 'while' ? !s:lookForParens('\<do\>\C', '\<while\>\C','bW',100) : 1))
8080
endfunction
8181

0 commit comments

Comments
 (0)