Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Suppose I have some large datafile, which overflow the screen in both vertical and horizontal direction. How can I browse this file, while the header-lines stay on the screen?

For the moment, I am using less -S, so that I can nicely scroll my file horizontally and vertically. However, when scrolling down, the header lines obviously disappear. Is there a way to keep these using less?

An alternative is using vim in split-screen mode with :set nowrap. However, now if I scroll horizontally, the top window doesn't scroll in the same way (:windo set scrollbind only works for vertical scrolling as far as I know).

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

If you're familiar with vim, this is probably the best option for you. You can enable horizontal scroll bind by adding it to 'scrollopt':

set scrollopt+=hor

So with vim -u NONE, you get the desired behavior with:

:set scrollopt+=hor
:set nowrap
:windo set scrollbind

You may want to adjust 'sidescroll' and 'sidescrolloff' to change how many columns are skipped and how far from the edge skipping starts respectively.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.