Den 2015-07-28 18:02, BPJ skrev:
> I have a string of rows of dashes alternating with spaces,
> where the number of dashes/spaces is variable
>
> ----- ------- --- ----
>
> I want to get a List of the offsets of all the space sequences,
> kind of a match() with /g (that's the best I can do to describe
> it...) In the case above (ignoring the indent, I would get
> [6, 16, 20].
>
> It's the usual problem: I don't know the right :help keyword
>
> /bpj
>
Sorry for the noise. I gave up and did it the traditional way:
let colpos_l = []
let colpos = 0
let str_len = strlen(line)
while colpos < str_len
let colpos = matchend(sepline, '-\+\ze\s', colpos)
if colpos < 0
break
elseif colpos > 0
" call add(colpos_l, colpos)
call add(colpos_l, colpos)
endif
endwhile
I will make a 'plugin' of a generalized version of this though...
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment