Monday, November 14, 2016

Re: Command z doesn't work

On Mon, Nov 14, 2016 at 01:38:11PM -0500, Cesar Romani wrote:
> On 14/11/2016 12:56 p.m., Bryan Richter wrote:
>
> > On Sat, Nov 12, 2016 at 01:22:31PM -0800, lylez wrote:
> >
> >> On Tuesday, November 8, 2016 at 9:51:05 AM UTC-8, andalou wrote:
> >>
> >>> I'm using vim 80.069 on Windows with defaults.vim enabled.
> >>>
> >>> When pressing z<CR>, the cursor line is supposed to get to top of
> >>> window, but is placed 5 lines below the top.
> >>>
> >> Folks, this is a classic example of a bug masquerading as a
> >> feature. Not only does the z-<CR> functionality not work, but I
> >> can't even move the cursor above the fifth line being displayed by
> >> pressing the k key, unless the file is scrolled all the way to the
> >> top.
> >
> > To respectfully offer the counter position, this is a feature that
> > ensures the cursor line is surrounded by lines of context whenever
> > possible.
> >
> > What has changed between vim 7 and 8 is that the maintainers have
> > switched from one point of view to the other.
> >
> > I don't see any way to reconcile the two points of view other than
> > to provide an option to allow either position. Thankfully, that is
> > already done.
> >
>
> What do you read if you do ':help z'?
> You get:
>
> --------------------
> |z<CR>| z<CR> redraw, cursor line to top of window,
> cursor on first non-blank
> --------------------
>
> Where is top of window?
> Is it five lines after the top?

Aha, now I can agree there is room for improvement. The docs should be
updated to mention that z<CR> is impacted by 'scrolloff'.

That probably should have happened a long time ago, in fact.

I would submit a patch, but I'm not set up to be a vim contributor, and
I don't have the time to do so right now. Maybe someone else?

P.S. I don't use 'scrolloff', so I do not know if there is any other
general solution to the mutually incompatible goals of z<CR> and
'scrolloff'.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: