Re: How to set line N as top line of screen...
- GARY FURASH wrote:
> Is there an easy way to say "make line N" (e.g., 502) the top line of the502z+
> visual screen?
This is a Normal-mode command, not an Ex-command. It also places the
cursor on the first non-blank in the line, so if you have set
'scrolloff' to something else than its default of 0 there will be that
many lines above line N (except if N <= &scrolloff). If that is not
let l = a:line + &scrolloff
if l > line("$")
let l = line("$")
exe "normal" l . "z+"
command -nargs=0 -range -bar AtTop call RedrawAtTop(<line1>)
Invoke it then as
Just ":AtTop" will move the cursor line to the top, and move the cursor
down by 'scrolloff' lines to allow the previous cursor line to be at top.