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开发者_如何学Go line numbers to variables ?
let topline = line("w0")
let botline = line("w$")
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).
精彩评论