Skip to content

Commit 84e1cc1

Browse files
authored
cleaning
making a very bright sheen
1 parent 71c9fc8 commit 84e1cc1

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

indent/javascript.vim

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let b:did_indent = 1
1212
setlocal indentexpr=GetJavascriptIndent()
1313
setlocal nolisp
1414
setlocal indentkeys=0{,0},0),0],:,!^F,o,O,e
15-
setlocal cinoptions+=j1,J1,c1
15+
setlocal cinoptions+=j1,J1
1616

1717
let b:undo_indent = 'setlocal indentexpr< formatexpr< indentkeys< cinoptions<'
1818

@@ -146,21 +146,14 @@ function GetJavascriptIndent()
146146
if line !~ '^\%(\/\*\|\s*\/\/\)' && s:IsInComment(v:lnum, 1)
147147
return cindent(v:lnum)
148148
endif
149-
if line =~ '^\s*$' && getline(prevline) =~ '\%(\%(^\s*\/\/\|\/\*\).*\)\@<!\*\/' &&
150-
\ s:IsInComment(prevline, 1)
151-
return indent(prevline) - 1
152-
endif
153-
if line =~ '^\s*$' && lnum != prevline
154-
return indent(prevnonblank(v:lnum))
155-
endif
156149
if lnum == 0
157150
return 0
158151
endif
159152
if (line =~ s:expr_case)
160-
let s:cpo_switch = &cpo
153+
let cpo_switch = &cpo
161154
set cpo+=%
162155
let ind = cindent(v:lnum)
163-
let &cpo = s:cpo_switch
156+
let &cpo = cpo_switch
164157
return ind
165158
endif
166159
"}}}
@@ -194,7 +187,7 @@ function GetJavascriptIndent()
194187
let switch_offset = 0
195188
if index(map(synstack(v:lnum, 1), 'synIDattr( v:val, "name")'),'jsSwitchBlock') > -1
196189
let bnum = search('\<switch\s*(','nbw')
197-
let switch_offset = bnum < num || bnum == lnum ? 0 : &cino !~ ':' ? s:sw() :
190+
let switch_offset = bnum < num || bnum == lnum ? 0 : &cino !~ ':' || !has('float') ? s:sw() :
198191
\ float2nr(str2float(matchstr(&cino,'.*:\zs[-0-9.]*')) * (match(&cino,'.*:\zs[^,]*s') ? s:sw() : 1))
199192
endif
200193
if (line =~ g:javascript_opfirst ||

0 commit comments

Comments
 (0)