Wednesday, October 11, 2017

Re: scrolloff side effects are bothersome

On Tue, Oct 10, 2017 at 8:57 PM, Eli the Bearded
<vim@eli.users.panix.com> wrote:
> I've long used scrolloff intermittantly, but recently I tried adding it
> to my vimrc. I'm finding myself unhappy now.
>
> Straight from the scrolloff docs:
>
> *'scrolloff'* *'so'*
> 'scrolloff' 'so' number (default 0, set to 5 in |defaults.vim|)
> global
> {not in Vi}
> Minimal number of screen lines to keep above and below the cursor.
> This will make some context visible around where you are working. If
> you set it to a very large value (999) the cursor line will always be
> in the middle of the window (except at the start or end of the file or
> when long lines wrap).
> For scrolling horizontally see 'sidescrolloff'.
> NOTE: This option is set to 0 when 'compatible' is set.
>
> Not at all mentioned there is that the H and L movements are changed. As
> someone with a long habit of using yH and yL (or >>L, or dH, etc),
> trying to use scrolloff is annoying.
>
> Consider a large file, like .../libdata/vim/vim80/doc/options.txt
> You can open that file with ":help scrolloff" right now. Then try
> ":set scrolloff=0" <return> and "MyH", depending on screensize you get
> something like "12 lines yanked". Now try ":set scrolloff=999" and then
> "MyH" again. Now only the current line is yanked.
>
> What I would *expect* and what I would like is if H and L movements were
> not affected by scrolloff, and yanks, deletes, etc worked again to top
> and bottom of the screen. And if actually moving to top or bottom with a
> bare H or L, I'd expect the cursor to move, *and* the screen to scroll
> according to scrolloff.
>
> Doesn't this bother other people? Or does no one use scrolloff?
>
> Elijah

I don't use H/M/L but I do use PgUP/PgDn (whose effects are different)
though never with an operator. My usual 'scrolloff' setting is 6.

Experiment shows that the displayed lines don't scroll for H/M/L,
regardless of the 'scrolloff' setting, so the somewhat cryptic
sentence «Cursor is adjusted for 'scrolloff' option.» under both
":help H" and ":help L" means (IIUC) that the top and bottom are to be
understood exclusive of the 'scrolloff' lines, though there are no top
'scrolloff' lines at the top of the file and no bottom 'scrolloff'
lines at the bottom of the file. Or alternatively, that H moves the
cursor as high as possible, L as low as possible, and M halfway
between these, but in all cases without having 'scrolloff' scroll the
window contents. As you noticed, if 'scrolloff' is set very high,
H/M/L all keep the cursor on the same (middle) line but move it
horizontally to the first nonblank.

If the bottom line of the file is displayed higher than the bottom of
the window, the M line is correspondingly adjusted halfway between
that and the H line (top of the window plus possible 'scrolloff').

IMHO the present behaviour is consistent but the help could be made clearer.


Best regards,
Tony.

--
--
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:

Post a Comment