Skip to content

Misc regex improvements #661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 7, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions indent/javascript.vim
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ endfunction

" configurable regexes that define continuation lines, not including (, {, or [.
if !exists('g:javascript_opfirst')
let g:javascript_opfirst = '\%([<>,?^%|*&]\|\/[^/*]\|\([-.:+]\)\1\@!\|=>\@!\|in\%(stanceof\)\=\>\)'
let g:javascript_opfirst = '\%([<>,?^%|*&]\|\/[/*]\@!\|\([-.:+]\)\1\@!\|=>\@!\|in\%(stanceof\)\=\>\)'
endif
if !exists('g:javascript_continuation')
let g:javascript_continuation = '\%([<=,.?/*^%|&:]\|+\@<!+\|-\@<!-\|=\@<!>\|\<in\%(stanceof\)\=\)'
Expand All @@ -94,9 +94,9 @@ function s:iscontOne(i,num,cont)
let ind = indent(l:i) + (!l:cont * s:W)
let bL = 0
while l:i >= l:num && (!l:cont || ind > pind + s:W)
if indent(l:i) < ind " first line always true for !cont, false for !!cont
if indent(l:i) < ind " first line always true for !a:cont, false for !!a:cont
if s:OneScope(l:i,s:Trimline(l:i))
if expand('<cword>') ==# 'while' && s:GetPair(s:line_pre . '\C\<do\>','\C\<while\>','bW',s:skip_expr,100,l:num) > 0
if expand('<cword>') ==# 'while' && s:GetPair(s:line_pre . '\C\<do\>','\C\<while\>','bW',s:skip_expr,100,l:num + !!a:num) > 0
return 0
endif
let bL += 1
Expand Down Expand Up @@ -155,8 +155,8 @@ endfunction

function GetJavascriptIndent()
try
let save_magic = &magic
set magic
let save_magic = &magic
set magic
if !exists('b:js_cache')
let b:js_cache = [0,0,0]
endif
Expand Down Expand Up @@ -218,7 +218,7 @@ function GetJavascriptIndent()
let b:js_cache = [v:lnum,num,line('.') == v:lnum ? b:js_cache[2] : col('.')]

call cursor(v:lnum,1)
if l:line =~# '^while\>' && s:GetPair(s:line_pre . '\C\<do\>','\C\<while\>','bW',s:skip_expr,100,num) > 0
if l:line =~# '^while\>' && s:GetPair(s:line_pre . '\C\<do\>','\C\<while\>','bW',s:skip_expr,100,num + 1) > 0
return indent(line('.'))
endif

Expand Down