Some function in vim return a byte index instead of a character index (e.g. match()). If the matched string contains multibyte characters this byte index differs from the character index.

Does vim provide a way to calculate the character index from such a byte index?

1 Answer 1


I just found it: charidx() allows this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.