Getting the current character position of the cursor

23 views
Skip to first unread message

Yegappan Lakshmanan

unread,
Dec 26, 2020, 11:59:11 AM12/26/20
to vim...@googlegroups.com, vim_dev
Hi,

The getcurpos() and col() functions return the byte position of the cursor.
Is there a function that returns the character position of the cursor in
the current line?

The byteidx() function returns the byte index given the character index
in a string. I am looking for the opposite.

Thanks,
Yegappan

Yegappan Lakshmanan

unread,
Dec 26, 2020, 12:18:25 PM12/26/20
to vim...@googlegroups.com, vim_dev
Neovim has the vim.str_utfindex() function that returns the character
index of a given byte index in a string:


I am looking for a similar function to use in Vim.

- Yegappan
 
Reply all
Reply to author
Forward
0 new messages