38
38
endif
39
39
40
40
let s: line_pre = ' ^\s*\%(\/\*.*\*\/\s*\)*'
41
- let s: expr_case = s: line_pre . ' \%(\%(case\>.*\)\|default\)\s*:\C '
41
+ let s: expr_case = s: line_pre . ' \%(\%(case\>.*\)\|default\)\s*:'
42
42
" Regex of syntax group names that are or delimit string or are comments.
43
- let s: syng_strcom = ' \%(string\|regex\|special\|doc\|comment\|template\)\c '
43
+ let s: syng_strcom = ' \%(string\|regex\|special\|doc\|comment\|template\)'
44
44
45
45
" Regex of syntax group names that are strings or documentation.
46
- let s: syng_comment = ' \%(comment\|doc\)\c '
46
+ let s: syng_comment = ' \%(comment\|doc\)'
47
47
48
48
" Expression used to check whether we should skip a match with searchpair().
49
49
let s: skip_expr = " line('.') < (prevnonblank(v:lnum) - 2000) ? dummy : s:IsSyn(line('.'),col('.'),'')"
@@ -60,23 +60,23 @@ let s:line_term = '\s*\%(\/\*.*\*\/\s*\)*$'
60
60
61
61
" configurable regexes that define continuation lines, not including (, {, or [.
62
62
if ! exists (' g:javascript_opfirst' )
63
- let g: javascript_opfirst = ' \%([<>,:?^%]\|\([-/.+]\)\%(\1\|\*\|\/\)\@!\|\*\/\@!\|=>\@!\||\|&\|in\%(stanceof\)\=\>\)\C '
63
+ let g: javascript_opfirst = ' \%([<>,:?^%]\|\([-/.+]\)\%(\1\|\*\|\/\)\@!\|\*\/\@!\|=>\@!\||\|&\|in\%(stanceof\)\=\>\)'
64
64
endif
65
65
let g: javascript_opfirst = s: line_pre . g: javascript_opfirst
66
66
67
67
if ! exists (' g:javascript_continuation' )
68
- let g: javascript_continuation = ' \%([<*,.?:^%]\|+\@<!+\|-\@<!-\|=\@<!>\|\*\@<!\/\|=\||\|&\|\<in\%(stanceof\)\=\)\C '
68
+ let g: javascript_continuation = ' \%([<*,.?:^%]\|+\@<!+\|-\@<!-\|=\@<!>\|\*\@<!\/\|=\||\|&\|\<in\%(stanceof\)\=\)'
69
69
endif
70
70
let g: javascript_continuation .= s: line_term
71
71
72
72
function s: Onescope (lnum,text,add )
73
- return a: text = ~ ' \%(\<else\|\<do\|=>' . (a: add ? ' \|\<try\|\<finally' : ' ' ) . ' \)\C ' . s: line_term ||
73
+ return a: text = ~# ' \%(\<else\|\<do\|=>' . (a: add ? ' \|\<try\|\<finally' : ' ' ) . ' \)' . s: line_term ||
74
74
\ ((a: add && a: text = ~ s: line_pre . s: line_term && search (' \%' . s: PrevCodeLine (a: lnum - 1 ) . ' l.)' . s: line_term )) ||
75
75
\ cursor (a: lnum , match (a: text , ' )' . s: line_term )) > -1 ) &&
76
76
\ s: lookForParens (' (' , ' )' , ' cbW' , 100 ) > 0 &&
77
- \ search ((a: add ? ' \%(function\*\|[A-Za-z_$][0-9A-Za-z_$]*\)\C ' :
78
- \ ' \<\%(for\%(\s+each\)\=\|if\|let\|while\|with\)\C ' ) . ' \_s*\%#' ,' bW' ) &&
79
- \ (a: add || (expand (" <cword>" ) == ' while' ? ! s: lookForParens (' \<do\>\C' , ' \<while\>\C' ,' bW' ,100 ) : 1 ))
77
+ \ search ((a: add ? ' \%(function\*\|[A-Za-z_$][0-9A-Za-z_$]*\)' :
78
+ \ ' \<\%(for\%(\s+each\)\=\|if\|let\|while\|with\)' ) . ' \_s*\%#\C ' ,' bW' ) &&
79
+ \ (a: add || (expand (" <cword>" ) == # ' while' ? ! s: lookForParens (' \<do\>\C' , ' \<while\>\C' ,' bW' ,100 ) : 1 ))
80
80
endfunction
81
81
82
82
" Auxiliary Functions {{{2
@@ -151,7 +151,7 @@ function GetJavascriptIndent()
151
151
endif
152
152
let line = s: StripLine (line )
153
153
154
- if (line = ~ s: expr_case )
154
+ if (line = ~# s: expr_case )
155
155
let cpo_switch = &cpo
156
156
set cpo += %
157
157
let ind = cindent (v: lnum )
@@ -187,13 +187,13 @@ function GetJavascriptIndent()
187
187
return indent (num)
188
188
endif
189
189
let inb = num == 0 ? 1 : s: Onescope (num, s: StripLine (strpart (getline (num),0 ,b: js_cache [2 ] - 1 )),1 )
190
- let switch_offset = (! inb || num == 0 ) || expand (" <cword>" ) != ' switch' ? 0 : &cino !~ ' :' || ! has (' float' ) ? s: sw () :
190
+ let switch_offset = (! inb || num == 0 ) || expand (" <cword>" ) !=# ' switch' ? 0 : &cino !~ ' :' || ! has (' float' ) ? s: sw () :
191
191
\ float2nr (str2float (matchstr (&cino ,' .*:\zs[-0-9.]*' )) * (match (&cino ,' .*:\zs[^,]*s' ) ? s: sw () : 1 ))
192
192
let pline = s: StripLine (getline (lnum))
193
- if ((line = ~ g: javascript_opfirst ||
194
- \ (pline = ~ g: javascript_continuation && pline !~ s: expr_case &&
193
+ if ((line = ~# g: javascript_opfirst ||
194
+ \ (pline = ~# g: javascript_continuation && pline !~# s: expr_case &&
195
195
\ (pline !~ ' :' . s: line_term || line !~# s: line_pre .
196
- \ ' \%(debugger\|do\|else\|finally\|for\|if\|let\|switch\|throw\|try\|while\|with\)' ))) &&
196
+ \ ' \%(debugger\|do\|else\|finally\|for\|if\|let\|switch\|throw\|try\|while\|with\)\> ' ))) &&
197
197
\ inb) || (s: Onescope (lnum,pline,0 ) && line !~ s: line_pre . ' {' )
198
198
return (num > 0 ? indent (num) : - s: sw ()) + (s: sw () * 2 ) + switch_offset
199
199
elseif num > 0
0 commit comments