2014-03-30 12:51 GMT+04:00 Nikolay Pavlov <[email protected]>:

>
> On Mar 30, 2014 4:19 AM, "Dmitry Frank" <[email protected]> wrote:
> >
> > Then, how can I get the symbol index (not byte offset) of a match?
> >
> > There is awesome plugin "PreciseJump":
> http://www.vim.org/scripts/script.php?script_id=3437 , it gets array of
> all symbols of the line, like that:
> >
> >         let lines_with_markers[l] = split(getline(l), '\zs')
> >
> > So that here's symbol index is needed, not byte offset. Because of this,
> it fails if there's multi-byte chars before the match.
> >
> > Currently, it's calculated like this:
> >
> >         let match_start = match(getline(l), a:re, 0, 1)
> >
> > Please suggest how to get symbol index instead.
>
> Please define "symbol". /\zs split takes composing characters and
> codepoint they modify as one symbol. If this is what you want use
> len(split(str[: match_start-1], '\zs')). Use strchars(str[: match_start-1])
> if you want them counted separately. Use strdisplaywidth() if you need
> count for the jump-to-virtcol (pipe) motion.
>
Yes thanks, I've already found that I can use strchars() for that. By
"symbol" I meant "char", sorry for wrong term.

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui