Reputation: 10939
I know I can go to the first and last visible line of current buffer with H and L respectively. But how I can pass the line numbers to variables ?
Upvotes: 5
Views: 2067
Reputation: 76316
There might be a better way, but if nothing else, you can use H
and L
to move there and ``
to get back and get. Something like
norm 'H'
let top=line('.')
norm '``L'
let bottom=line('.')
norm '``'
or you can use getpos()
to store and setpos()
to restore the position, but I am not sure you can avoid destroying the previous position mark (the :keepmarks
command should do that, but it's documentation says it only works in some special case).
Upvotes: 0