From c230efb9f7b1bda95947640d6584f5b8143b840d Mon Sep 17 00:00:00 2001 From: bounceme Date: Wed, 27 Jul 2016 12:26:17 -0700 Subject: [PATCH] allow for line breaks before blocks --- indent/javascript.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indent/javascript.vim b/indent/javascript.vim index 18ad9630..1b3706b6 100644 --- a/indent/javascript.vim +++ b/indent/javascript.vim @@ -73,9 +73,9 @@ function s:Onescope(lnum,text,add) return a:text =~ '\%(\' . (a:add ? '\|try\|finally' : '' ) . '\)\C' . s:line_term || \ (cursor(a:lnum, match(a:text, ')' . s:line_term)) > -1 && \ s:lookForParens('(', ')', 'cbW', 100) > 0 && - \ cursor(line('.'),match( ' ' . strpart(getline(line('.')),0,col('.') - 1), - \ (a:add ? '\K\k*' : - \ '\<\%(else\|for\%(\s+each\)\=\|function\*\=\%(\s\+\K\k*\)\=\|if\|let\|switch\|while\|with\)\C') . s:line_term)) > -1) && + \ search((a:add ? '\K\k*' : + \ '\<\%(else\|for\%(\s+each\)\=\|function\*\=\%(\s\+\K\k*\)\=\|if\|let\|switch\|while\|with\)\C') . + \ '\_s*\%#','bW')) && \ (a:add || (expand("") == 'while' ? !s:lookForParens('\\C', '\\C','bW',100) : 1)) endfunction