Skip to content

Commit f253975

Browse files
authored
more cleaning
1 parent 84e1cc1 commit f253975

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

indent/javascript.vim

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ setlocal nolisp
1414
setlocal indentkeys=0{,0},0),0],:,!^F,o,O,e
1515
setlocal cinoptions+=j1,J1
1616

17-
let b:undo_indent = 'setlocal indentexpr< formatexpr< indentkeys< cinoptions<'
17+
let b:undo_indent = 'setlocal indentexpr< indentkeys< cinoptions<'
1818

1919
" Only define the function once.
2020
if exists("*GetJavascriptIndent")
@@ -137,6 +137,9 @@ function GetJavascriptIndent()
137137
let prevline = prevnonblank(v:lnum - 1)
138138
" previous line of code
139139
let lnum = s:PrevNonBlankNonString(v:lnum - 1)
140+
if lnum == 0
141+
return 0
142+
endif
140143

141144
" start with strings,comments,etc.{{{2
142145
if (line !~ '^[''"`]' && synIDattr(synID(v:lnum, 1, 1), 'name') =~? 'string\|template') ||
@@ -146,9 +149,7 @@ function GetJavascriptIndent()
146149
if line !~ '^\%(\/\*\|\s*\/\/\)' && s:IsInComment(v:lnum, 1)
147150
return cindent(v:lnum)
148151
endif
149-
if lnum == 0
150-
return 0
151-
endif
152+
152153
if (line =~ s:expr_case)
153154
let cpo_switch = &cpo
154155
set cpo+=%

0 commit comments

Comments
 (0)