Monday, February 21, 2022

Re: How to bind scrolling horizontal split windows?

On 2022-02-21, Igor wrote:
> Hi,
> I am using Vim 7.4 on Linux.

> Now to the actual problem. I have text of multiple columns with header. When I
> move down a buffer I no longer see head of columns, so I vertically slit
> window. Top window is at first line position to see column headers, bottom
> window I use to see data in e.g. 1000 row. I can easily in e.g. column 5 the
> data in line 1000 and header from line 1. But when in e.g. bottom window I
> scroll to the right, I would like both windows to scroll to the right like they
> are bound together, so I can see e.g. 100 columns body and header, but instead
> only current buffer in current window is scrolled.

The 'scrollopt' option lets you choose to bind vertical scrolling
(the default), horizontal scrolling, or both.

:e some_file
:set nowrap
:set scrollopt-=ver
:set scrollopt+=hor
:set scrollbind
:split

See

:help 'scrollopt'

> Now instead of ":sp" in second command turn on vertical split screen ":vsp" How
> to turn on vertical scrollbind?

I'm not sure I understand you. Vertical scrollbinding is the
default. Do you mean that you want something like this, where the
buffer is vertically split but each half has the column headers
above it, with the vertically-split windows vertically scrollbound
while the horizontally-split windows are horizontally scrollbound?

+---------+---------+
| headers | headers |
+---------+---------+
| | |
| body | body |
| | |
+---------+---------+

Unfortunately for this case, 'scrollopt' is a global option. You
can have all scrollbound windows scroll together horizontally or
vertically (or both), but you can't have some windows bound
horizontally while others are bound vertically.

Regards,
Gary

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20220221140135.GA19760%40phoenix.

No comments:

Post a Comment