Skip to content

Commit 8ac7bad

Browse files
authored
Remove all extra grouping (#697)
1 parent bedb8cb commit 8ac7bad

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

indent/javascript.vim

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ else
3737
endfunction
3838
endif
3939

40-
let s:case_stmt = '\<\%(\%(case\>\s*[^[:blank:]:].\{-}\)\|default\)\s*:\C'
40+
let s:case_stmt = '\<\%(case\>\s*[^[:blank:]:].\{-}\|default\s*\):\C'
4141

4242
" Regex of syntax group names that are or delimit string or are comments.
43-
let s:syng_strcom = '\%(s\%(tring\|pecial\)\|comment\|regex\|doc\|template\)'
43+
let s:syng_strcom = 'string\|comment\|regex\|special\|doc\|template'
4444
" Expression used to check whether we should skip a match with searchpair().
4545
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),0),'name') =~? '".s:syng_strcom."'"
4646
function s:skip_func(lnum)
47-
if !s:free || search('`\|\%(\*\/\)','nW',a:lnum)
47+
if !s:free || search('`\|\*\/','nW',a:lnum)
4848
let s:free = !eval(s:skip_expr . " . '\\|html'")
4949
let s:looksyn = s:free ? line('.') : s:looksyn
5050
return !s:free
@@ -79,7 +79,7 @@ endfunction
7979
function s:Trim(ln)
8080
let pline = substitute(getline(a:ln),'\s*$','','')
8181
let l:max = max([strridx(pline,'//'),strridx(pline,'/*'),0])
82-
while l:max && synIDattr(synID(a:ln, strlen(pline), 0), 'name') =~? '\%(comment\|doc\)'
82+
while l:max && synIDattr(synID(a:ln, strlen(pline), 0), 'name') =~? 'comment\|doc'
8383
let pline = substitute(strpart(pline, 0, l:max),'\s*$','','')
8484
let l:max = max([strridx(pline,'//'),strridx(pline,'/*'),0])
8585
endwhile
@@ -139,7 +139,7 @@ function s:IsBlock(...)
139139
let syn = char =~ '[{>/]' || l:ln != line('.') ? synIDattr(synID(line('.'),col('.')-(char == '{'),0),'name') : ''
140140
if char is ''
141141
return 1
142-
elseif syn =~? '\%(xml\|jsx\)'
142+
elseif syn =~? 'xml\|jsx'
143143
return char != '{'
144144
elseif syn =~? 'comment'
145145
return search('\/[/*]','bW') && s:IsBlock(l:ln)
@@ -194,13 +194,13 @@ function GetJavascriptIndent()
194194
let syns = synIDattr(synID(v:lnum, 1, 0), 'name')
195195

196196
" start with strings,comments,etc.
197-
if syns =~? '\%(comment\|doc\)'
197+
if syns =~? 'comment\|doc'
198198
if l:line =~ '^\s*\*'
199199
return cindent(v:lnum)
200200
elseif l:line !~ '^\s*\/'
201201
return -1
202202
endif
203-
elseif syns =~? '\%(string\|template\)' && l:line !~ '^[''"]'
203+
elseif syns =~? 'string\|template' && l:line !~ '^[''"]'
204204
return -1
205205
endif
206206
let l:lnum = s:PrevCodeLine(v:lnum - 1)

0 commit comments

Comments
 (0)