Hi Richard!
On Fr, 11 Mai 2012, Richard wrote:
> When mixing characters and multibyte characters how
> to get the number of characters at the cursor.
> The multibyte analogy of col('.'), which returns number of
> bytes - what returns number of characters.
I think, something like this should work, not sure, if there is an
easier way:
len(split(matchstr(getline('.')[:col('.')],'.*'), '\zs'))
strdisplaywidth(matchstr(getline('.'), '^.*\%'.col('.').'c'))
strlen(substitute(getline('.')[:col('.')], '.', 'x','g'))
see the help at
:h strdisplaywidth()
:h strwidth()
:h strlen()
:h len()
> Also, like to set cursor position using number of characters
> in the column (similar to cursor(line, col) where col is the number of
> bytes but some call that uses number of characters).
:h |
:h l
:h h
regards,
Christian
--
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
Saturday, May 12, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment