Skip to content

more fixes #432

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 1 commit into from
May 12, 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
28 changes: 17 additions & 11 deletions indent/javascript.vim
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,11 @@ function s:IndentWithContinuation(lnum, ind, width)
if s:Match(lnum, s:continuation_regex)
if lnum == p_lnum
return msl_ind + a:width
else
elseif !s:InMultiVarStatement(a:lnum)
return msl_ind
endif
else
return msl_ind - a:width
end
endif

return a:ind
Expand Down Expand Up @@ -401,8 +403,12 @@ function GetJavascriptIndent()
" If the line is comma first, dedent 1 level
if (getline(prevline) =~ s:comma_first)
return indent(prevline) - s:sw()
elseif getline(s:PrevNonBlankNonString(prevline - 1)) =~ '[])}]' . s:comma_last && getline(prevline) !~ s:comma_last && getline(prevline) !~ s:block_regex
return indent(prevline) - s:sw()
elseif getline(s:PrevNonBlankNonString(prevline - 1)) =~ '[])}]' . s:comma_last && getline(prevline) !~ s:block_regex
if getline(prevline) !~ s:comma_last
return indent(prevline) - s:sw()
else
return indent(prevline)
end
end

" If line starts with an operator...
Expand Down Expand Up @@ -447,13 +453,13 @@ function GetJavascriptIndent()
end
end

if getline(prevline) =~ '^\s*`$' && s:IsInTempl(v:lnum, 1)
if line !~ '^\s*`$'
return indent(prevline) + s:sw()
endif
elseif line =~ '^\s*`$' && s:IsInTempl(prevline, 1)
return indent(prevline) - s:sw()
endif
" if getline(prevline) =~ '^\s*`$' && s:IsInTempl(v:lnum, 1)
" if line !~ '^\s*`$'
" return indent(prevline) + s:sw()
" endif
" elseif line =~ '^\s*`$' && s:IsInTempl(prevline, 1)
" return indent(prevline) - s:sw()
" endif

" Check for multiple var assignments
" let var_indent = s:GetVarIndent(v:lnum)
Expand Down