Skip to content

Commit ba2245f

Browse files
authored
Misc improvements (#661)
1 parent f674cba commit ba2245f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

indent/javascript.vim

+6-6
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ endfunction
7272

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

156156
function GetJavascriptIndent()
157157
try
158-
let save_magic = &magic
159-
set magic
158+
let save_magic = &magic
159+
set magic
160160
if !exists('b:js_cache')
161161
let b:js_cache = [0,0,0]
162162
endif
@@ -218,7 +218,7 @@ function GetJavascriptIndent()
218218
let b:js_cache = [v:lnum,num,line('.') == v:lnum ? b:js_cache[2] : col('.')]
219219

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

0 commit comments

Comments
 (0)