Simplified s:count
This commit is contained in:
parent
35fae13d17
commit
0a52d3afd9
@ -145,14 +145,12 @@ let s:tikz_commands = '\v\\%(' . join([
|
|||||||
|
|
||||||
function! s:count(line, pattern) " {{{1
|
function! s:count(line, pattern) " {{{1
|
||||||
let sum = 0
|
let sum = 0
|
||||||
let indx = match(a:line, a:pattern)
|
while 1
|
||||||
while indx >= 0
|
if match(a:line, a:pattern, 0, sum + 1) == -1
|
||||||
|
return sum
|
||||||
|
endif
|
||||||
let sum += 1
|
let sum += 1
|
||||||
let match = matchstr(a:line, a:pattern, indx)
|
|
||||||
let indx += len(match)
|
|
||||||
let indx = match(a:line, a:pattern, indx)
|
|
||||||
endwhile
|
endwhile
|
||||||
return sum
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" }}}1
|
" }}}1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user