Skip to content

multi-braceless statements #636

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 19 commits into from
Sep 18, 2016
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update javascript.vim
  • Loading branch information
bounceme authored Sep 18, 2016
commit 61b8587fe8e86679c2fead45f7416b21a6b5c8cd
6 changes: 3 additions & 3 deletions indent/javascript.vim
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ function s:iscontOne(i,num,cont)
let ind = indent(l:i) + (!l:cont ? s:sw() : 0)
let bL = 0
while l:i >= l:num && (!l:cont || ind > pind + s:sw())
if indent(l:i) < ind
if s:OneScope(l:i,getline(l:i))
if indent(l:i) < ind " first line always true for !cont, false for cont
if s:OneScope(l:i,substitute(getline(l:i),':\@<!\/\/.*','',''))
if expand('<cword>') ==# 'while' && searchpair(s:line_pre . '\C\<do\>','','\C\<while\>','bW',s:skip_expr,l:num,100)
return 0
endif
Expand Down Expand Up @@ -208,7 +208,7 @@ function GetJavascriptIndent()
return indent(line('.'))
endif

let pline = substitute(substitute(getline(l:lnum),s:expr_case,'\=repeat(" ",strlen(submatch(0)))',''), '\%(:\@<!\/\/.*\)$', '','')
let pline = substitute(substitute(getline(l:lnum),s:expr_case,'\=repeat(" ",strlen(submatch(0)))',''), ':\@<!\/\/.*', '','')
call cursor(b:js_cache[1],b:js_cache[2])
let switch_offset = num <= 0 || !(search(')\_s*\%#','bW') &&
\ s:GetPair('(', ')', 'bW', s:skip_expr, 100) > 0 && search('\C\<switch\_s*\%#','bW')) ? 0 :
Expand Down