Skip to content

Commit f16fe69

Browse files
authored
Change function names
1 parent aadf36b commit f16fe69

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

indent/javascript.vim

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ let s:syng_comment = '\%(comment\|doc\)'
4949
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),0),'name') =~? '".s:syng_strcom."'"
5050

5151
if has('reltime')
52-
function s:lookForParens(start,end,flags,time)
52+
function s:GetPair(start,end,flags,time)
5353
return searchpair(a:start,'',a:end,a:flags,s:skip_expr,max([prevnonblank(v:lnum) - 2000,0]),a:time)
5454
endfunction
5555
else
56-
function s:lookForParens(start,end,flags,n)
56+
function s:GetPair(start,end,flags,n)
5757
return searchpair(a:start,'',a:end,a:flags,0,max([prevnonblank(v:lnum) - 2000,0]))
5858
endfunction
5959
endif
@@ -75,16 +75,16 @@ function s:Onescope(lnum,text,add)
7575
return a:text =~# '\%(\<else\|\<do\|=>\)' . s:line_term ? 'no b' :
7676
\ ((a:add && a:text =~ s:line_pre . '$' && search('\%' . s:PrevCodeLine(a:lnum - 1) . 'l.)' . s:line_term)) ||
7777
\ cursor(a:lnum, match(a:text, ')' . s:line_term)) > -1) &&
78-
\ s:lookForParens('(', ')', 'cbW', 100) > 0 && search('\C\l\+\_s*\%#','bW') &&
79-
\ (a:add || ((expand('<cword>') !=# 'while' || !s:lookForParens('\C\<do\>', '\C\<while\>','nbW',100)) &&
78+
\ s:GetPair('(', ')', 'cbW', 100) > 0 && search('\C\l\+\_s*\%#','bW') &&
79+
\ (a:add || ((expand('<cword>') !=# 'while' || !s:GetPair('\C\<do\>', '\C\<while\>','nbW',100)) &&
8080
\ expand('cword') !=# 'each' || search('\C\<for\_s\+\%#','nbW'))) ? expand('<cword>') : ''
8181
endfunction
8282

8383
" https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader
84-
function s:isBlock()
84+
function s:IsBlock()
8585
return getline(line('.'))[col('.')-1] == '{' && !search(
8686
\ '\C\%(\%([-=~!<*+,.?^%|&\[(]\|=\@<!>\|\*\@<!\/\|\<\%(var\|const\|let\|yield\|delete\|void\|t\%(ypeof\|hrow\)\|new\|\<in\%(stanceof\)\=\)\)\_s*\|\<return\s*\)\%#','bnW') &&
87-
\ (!search(':\_s*\%#','bW') || (!s:lookForParens('[({[]','[])}]','bW',200) || s:isBlock()))
87+
\ (!search(':\_s*\%#','bW') || (!s:GetPair('[({[]','[])}]','bW',200) || s:IsBlock()))
8888
endfunction
8989

9090
" Auxiliary Functions {{{2
@@ -166,9 +166,9 @@ function GetJavascriptIndent()
166166
elseif syns != '' && l:line[0] =~ '\s'
167167
let pattern = syns =~? 'block' ? ['{','}'] : syns =~? 'jsparen' ? ['(',')'] :
168168
\ syns =~? 'jsbracket'? ['\[','\]'] : ['[({[]','[])}]']
169-
let num = s:lookForParens(pattern[0],pattern[1],'bW',2000)
169+
let num = s:GetPair(pattern[0],pattern[1],'bW',2000)
170170
else
171-
let num = s:lookForParens('[({[]','[])}]','bW',2000)
171+
let num = s:GetPair('[({[]','[])}]','bW',2000)
172172
endif
173173
let b:js_cache = [v:lnum,num,line('.') == v:lnum ? b:js_cache[2] : col('.')]
174174

@@ -178,7 +178,7 @@ function GetJavascriptIndent()
178178

179179
let pline = s:StripLine(getline(l:lnum))
180180
call cursor(b:js_cache[1],b:js_cache[2])
181-
let inb = num == 0 || num < l:lnum && ((l:line !~ s:line_pre . ',' && pline !~ ',' . s:line_term) || s:isBlock())
181+
let inb = num == 0 || num < l:lnum && ((l:line !~ s:line_pre . ',' && pline !~ ',' . s:line_term) || s:IsBlock())
182182
let switch_offset = num == 0 || s:Onescope(num, s:StripLine(strpart(getline(num),0,b:js_cache[2] - 1)),1) !=# 'switch' ? 0 :
183183
\ &cino !~ ':' || !has('float') ? s:sw() :
184184
\ float2nr(str2float(matchstr(&cino,'.*:\zs[-0-9.]*')) * (&cino =~# '.*:[^,]*s' ? s:sw() : 1))

0 commit comments

Comments
 (0)