Skip to content

Commit 9dda622

Browse files
committed
Fixes case where there are nested conditionals
1 parent 85eeb98 commit 9dda622

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

indent/javascript.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ let s:comma_first = '^\s*,'
6565
let s:comma_last = ',\s*$'
6666

6767
let s:ternary = '^\s\+[?|:]'
68+
let s:ternary_q = '^\s\+?'
6869

6970
" 2. Auxiliary Functions {{{1
7071
" ======================
@@ -342,7 +343,7 @@ function GetJavascriptIndent()
342343
endif
343344

344345
if (line =~ s:ternary)
345-
if (getline(prevline) =~ s:ternary)
346+
if (getline(prevline) =~ s:ternary_q)
346347
return indent(prevline)
347348
else
348349
return indent(prevline) + &sw

0 commit comments

Comments
 (0)