Aidan Do
Aidan Do

Reputation: 96

How do I get the bottom line in vimscript?

I'm trying to get the line number of the bottom of the current screen. I've tried:

winsaveview()['topline'] + winheight(0) - 1

But this doesn't take into account folds.

How do I get the bottom line of the current screen in vimscript that takes into account folds?

Upvotes: 1

Views: 257

Answers (1)

Peter Rincker
Peter Rincker

Reputation: 45147

You can use line() with w$ to get last line visible in current window

:echo line('w$')

For more help see :h line()

Upvotes: 5

Related Questions