> Thanks for the replies!
>
> The problem however isn't solved...
>
> Having obtained the current byte index using col("."), I can't simply add n
> to/subtract n from the return value of col(".") to find the beginning of
> the next/previous multi-byte character (the -1 offset is ok because there's
> a base bias).
> I could use col(".") repeatedly but I would have to move the cursor
> ("normal l" or "normal h") beforehand.
> Also, I could write a function that would analyze the UTF-8 header bits
> ("11110", "1110", "110", or "10") to determine the required position, but I
> was hoping that there's another (easier) way to accomplish this.
Don't worry too much, you're not the first man on the Vim planet ;-)
> Is there any function that lets me determine the byte position of the
> beginning of the next/previous multi-byte character? I've seen none in the
> docs...
Get the byte-position just after the match:
:echo matchend(getline("."), ".", col(".")-1)
Get a list of characters in the current line:
:echo split(getline("."), '\zs')
Get a list of characters in the line, starting at the cursor position:
:echo split(strpart(getline("."), col(".")-1), '\zs')
--
Andy
--
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
No comments:
Post a Comment