Saturday, December 26, 2020

Re: Getting the current character position of the cursor


On Sat, Dec 26, 2020 at 8:58 AM Yegappan Lakshmanan <yegappanl@gmail.com> wrote:
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.


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
 

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAAW7x7knwTHiTa-8%2BcCnMceQDPgx6pXxU_kDzvN1TbAuGCsg9w%40mail.gmail.com.

No comments: