Skip to content

Commit 71c9fc8

Browse files
authored
negative and decimal switch label values (#569)
allows for every possible option including: `set cino+=:-0.5s` `set cino+=:-.5s`
1 parent df6c7ef commit 71c9fc8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

indent/javascript.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ function GetJavascriptIndent()
195195
if index(map(synstack(v:lnum, 1), 'synIDattr( v:val, "name")'),'jsSwitchBlock') > -1
196196
let bnum = search('\<switch\s*(','nbw')
197197
let switch_offset = bnum < num || bnum == lnum ? 0 : &cino !~ ':' ? s:sw() :
198-
\ matchstr(&cino,'.*:\zs[0-9.]*') * (match(&cino,'.*:\zs[^,]*s') ? s:sw() : 1)
198+
\ float2nr(str2float(matchstr(&cino,'.*:\zs[-0-9.]*')) * (match(&cino,'.*:\zs[^,]*s') ? s:sw() : 1))
199199
endif
200200
if (line =~ g:javascript_opfirst ||
201201
\ (getline(lnum) =~ g:javascript_continuation && getline(lnum) !~ s:expr_case) ||

0 commit comments

Comments
 (0)