@@ -46,9 +46,6 @@ let s:expr_case = '^\s*\(case\s\+[^\:]*\|default\)\s*:\s*'
46
46
" Regex of syntax group names that are or delimit string or are comments.
47
47
let s: syng_strcom = ' \%(string\|regex\|comment\|template\)\c'
48
48
49
- " Regex of syntax group names that are or delimit template strings
50
- let s: syng_template = ' template\c'
51
-
52
49
" Regex of syntax group names that are strings.
53
50
let s: syng_string = ' regex\c'
54
51
@@ -106,11 +103,6 @@ function s:IsInString(lnum, col)
106
103
return synIDattr (synID (a: lnum , a: col , 1 ), ' name' ) = ~ s: syng_string
107
104
endfunction
108
105
109
- " Check if the character at lnum:col is inside a template string.
110
- function s: IsInTempl (lnum, col )
111
- return synIDattr (synID (a: lnum , a: col , 1 ), ' name' ) = ~ s: syng_template
112
- endfunction
113
-
114
106
" Check if the character at lnum:col is inside a multi-line comment.
115
107
function s: IsInMultilineComment (lnum, col )
116
108
return ! s: IsLineComment (a: lnum , a: col ) && synIDattr (synID (a: lnum , a: col , 1 ), ' name' ) = ~ s: syng_multiline
@@ -137,7 +129,7 @@ function s:PrevNonBlankNonString(lnum)
137
129
endif
138
130
elseif ! in_block && s: IsInMultilineComment (lnum, matchend (line , ' \*/' ) - 1 )
139
131
let in_block = 1
140
- elseif ! in_block && line !~ ' ^\s*\%(//\).*$' && ! (s: IsInStringOrComment (lnum, 1 ) && ! s: IsInTempl (lnum, 1 ) && s: IsInStringOrComment (lnum, strlen (line )))
132
+ elseif ! in_block && line !~ ' ^\s*\%(//\).*$' && ! (s: IsInStringOrComment (lnum, 1 ) && s: IsInStringOrComment (lnum, strlen (line )))
141
133
break
142
134
endif
143
135
let lnum = prevnonblank (lnum - 1 )
@@ -329,12 +321,12 @@ endfunction
329
321
" =========================
330
322
331
323
function GetJavascriptIndent ()
332
- " 3.1. Setup {{{2
324
+ " 3.1. Setup {{{1
333
325
" ----------
334
326
" Set up variables for restoring position in file. Could use v:lnum here.
335
327
let vcol = col (' .' )
336
328
337
- " 3.2. Work on the current line {{{2
329
+ " 3.2. Work on the current line {{{1
338
330
" -----------------------------
339
331
340
332
let ind = -1
@@ -344,7 +336,7 @@ function GetJavascriptIndent()
344
336
let prevline = prevnonblank (v: lnum - 1 )
345
337
346
338
" to not change multiline string values
347
- if ( synIDattr (synID (v: lnum , 1 , 1 ), ' name' ) = ~? ' string' || s: IsInTempl ( v: lnum , 1 )) && line !~ ' ^\s*['' "`]'
339
+ if synIDattr (synID (v: lnum , 1 , 1 ), ' name' ) = ~? ' string\|template ' && line !~ ' ^\s*['' "`]'
348
340
return indent (v: lnum )
349
341
endif
350
342
@@ -453,21 +445,13 @@ function GetJavascriptIndent()
453
445
end
454
446
end
455
447
456
- " if getline(prevline) =~ '^\s*`$' && s:IsInTempl(v:lnum, 1)
457
- " if line !~ '^\s*`$'
458
- " return indent(prevline) + s:sw()
459
- " endif
460
- " elseif line =~ '^\s*`$' && s:IsInTempl(prevline, 1)
461
- " return indent(prevline) - s:sw()
462
- " endif
463
-
464
448
" Check for multiple var assignments
465
449
" let var_indent = s:GetVarIndent(v:lnum)
466
450
" if var_indent >= 0
467
451
" return var_indent
468
452
" endif
469
453
470
- " 3.3. Work on the previous line. {{{2
454
+ " 3.3. Work on the previous line. {{{1
471
455
" -------------------------------
472
456
473
457
" If the line is empty and the previous nonblank line was a multi-line
@@ -523,7 +507,7 @@ function GetJavascriptIndent()
523
507
end
524
508
end
525
509
526
- " 3.4. Work on the MSL line. {{{2
510
+ " 3.4. Work on the MSL line. {{{1
527
511
" --------------------------
528
512
529
513
let ind_con = ind
@@ -550,7 +534,7 @@ endfunction
550
534
551
535
let &cpo = s: cpo_save
552
536
unlet s: cpo_save
553
-
537
+ " gq{{{2
554
538
function ! Fixedgq (lnum, count )
555
539
let l: tw = &tw ? &tw : 80 ;
556
540
@@ -611,3 +595,5 @@ function! Fixedgq(lnum, count)
611
595
612
596
return 0
613
597
endfunction
598
+ " }}}
599
+ " vim: foldmethod = marker:foldlevel = 1
0 commit comments