As title. I want to know the offset regardless of the current buffer. It's not the column number of the current buffer.

2 Answers 2


I believe the following call gives you the value you are searching:

let col = win_screenpos(winnr())[1]
  • 1
    While this is not what I really want, this is the right answer to my title. (Sorry for my bad English grammar. I was trying to describe the columns between the cursor and the left border of the current window) Still many thanks for your kindness in trying to help. Mar 26, 2023 at 8:48

It turns out the answer is wincol(), or written in Lua vim.fn.wincol().

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.