', 'nWb')
\ || 0 < searchpair(js, '', '', 'nW')
" we're inside javascript
if getline(lnum) !~ js && getline(a:lnum) !~ js
if restore_ic == 0
setlocal noic
endif
" Open and close bracket:
if s:isSyntaxElem(lnum, '{', "javaScriptBraces") || s:isSyntaxElem(a:lnum, '}', "javaScriptBraces")
" This doesn't distinguish between }{ and {}. That needs fixing.
let thisline = strlen(substitute(getline(a:lnum), '[^}]\+', '', 'g')) - strlen(substitute(getline(a:lnum), '[^{]\+', '', 'g'))
if thisline < 0
let thisline = 0
endif
let thatline = strlen(substitute(getline(lnum), '[^{]\+', '', 'g')) - strlen(substitute(getline(lnum), '[^}]\+', '', 'g'))
if thatline < 0
let thatline = 0
endif
return indent(lnum) - (thisline * &sw) + (thatline * &sw)
endif
" cases:
if s:isSyntaxElem(lnum, '\(case\|default\)', "javaScriptLabel") && s:isSyntaxElem(a:lnum, '\(case\|default\)', "javaScriptLabel")
return indent(lnum)
elseif s:isSyntaxElem(lnum, '\(case\|default\)', "javaScriptLabel")
return indent(lnum) + &sw
elseif s:isSyntaxElem(a:lnum, '\(case\|default\)', "javaScriptLabel")
return indent(lnum) - &sw
endif
if getline(a:lnum) =~ '\c'
let scriptline = prevnonblank(search(js, 'bW'))
if scriptline > 0
return indent(scriptline)
endif
endif
return indent(lnum)
endif
endif
if getline(a:lnum) =~ '\c\?body' || getline(a:lnum) =~ '\c\?html' || getline(a:lnum) =~ '\c\?head'
return 0
endif
if getline(lnum) =~ '\c\?body' || getline(lnum) =~ '\c\?html' || getline(lnum) =~ '\c\?head'
return 0
endif
if getline(lnum) =~ '\c'
" line before the current line a:lnum contains
" a closing . --> search for line before
" starting to restore the indent.
let preline = prevnonblank(search('\c', 'bW') - 1)
if preline > 0
if restore_ic == 0
setlocal noic
endif
return indent(preline)
endif
endif
let ind = HtmlIndentSum(lnum, -1)
let ind = ind + HtmlIndentSum(a:lnum, 0)
if restore_ic == 0
setlocal noic
endif
return indent(lnum) + (&sw * ind)
endfun
let &cpo = s:cpo_save
unlet s:cpo_save
" [-- EOF /indent/html.vim --]