1

How do I get the length, in bytes, of the current line in Lua?

vim.api.strlen('foo') doesn't work

1
  • Lua has unary "sizeof-like" operator # This is language core.
    – Matt
    Commented Jul 31, 2022 at 3:30

1 Answer 1

4

You can use the vim function col:

vim.fn.col('$')-1

Your Answer

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

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