Skip to content

Commit acb4f00

Browse files
authored
fix syn function
vimscript is strange
1 parent 506783b commit acb4f00

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

indent/javascript.vim

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ let s:syng_strcom = '\%(string\|regex\|special\|doc\|comment\|template\)\c'
4444
let s:syng_comment = '\%(comment\|doc\)\c'
4545

4646
" Expression used to check whether we should skip a match with searchpair().
47-
let s:skip_expr = "line('.') < (prevnonblank(v:lnum) - 2000) ? dummy : s:IsSyn(line('.'),col('.'),0)"
47+
let s:skip_expr = "line('.') < (prevnonblank(v:lnum) - 2000) ? dummy : s:IsSyn(line('.'),col('.'),'')"
4848

4949
func s:lookForParens(start,end,flags,time)
5050
try
@@ -82,14 +82,14 @@ endfunction
8282

8383
" Check if the character at lnum:col is inside a string, comment, or is ascii.
8484
function s:IsSyn(lnum, col, reg)
85-
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~? (a:reg ? a:reg : s:syng_strcom)
85+
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~? (a:reg != '' ? a:reg : s:syng_strcom)
8686
endfunction
8787

8888
" Find line above 'lnum' that isn't empty, in a comment, or in a string.
8989
function s:PrevNonBlankNonString(lnum)
9090
let lnum = prevnonblank(a:lnum)
9191
while lnum > 0
92-
if !s:IsSyn(lnum, matchend(getline(lnum), '^\s*[^''"]'),0)
92+
if !s:IsSyn(lnum, matchend(getline(lnum), '^\s*[^''"]'),'')
9393
break
9494
endif
9595
let lnum = prevnonblank(lnum - 1)
@@ -106,7 +106,7 @@ function s:LineHasOpeningBrackets(lnum)
106106
let pos = match(line, '[][(){}]', 0)
107107
let last = 0
108108
while pos != -1
109-
if !s:IsSyn(a:lnum, pos + 1, 0)
109+
if !s:IsSyn(a:lnum, pos + 1, '')
110110
let idx = stridx('(){}[]', line[pos])
111111
if idx % 2 == 0
112112
let open_{idx} = open_{idx} + 1

0 commit comments

Comments
 (0)