0

In the normal case, the first column is 1. But after a command like z10l to scroll rightward now the first column visible is 11 instead of 1. How do I get this 11?

My trying: I found that vim.fn.virtcol('.') can give what I want only if I place my cursor at the first visible column after z10l in the first place. Now the problem becomes what should I pass to virtcol.

4
  • It looks like :help WinScrolled-event might be of help.
    – romainl
    Jun 15, 2023 at 16:22
  • @romainl Thanks for the documentation, but is it possible to get the info without an autocmd? Jun 15, 2023 at 16:28
  • 1
    try :echo winsaveview()['leftcol'] Jun 15, 2023 at 16:40
  • @ChristianBrabandt Insane! This is the answer I think! If you have time you could write this into an answer. Jun 15, 2023 at 16:46

1 Answer 1

1

You can try the following:

:echo winsaveiew()['leftcol']

That should always show the correct column for the left border.

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.