Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrolling down both parts of a split-window at the same time in Vim

Tags:

vim

Is it possible to scroll down the left and right parts of a vertically split window in Vim? I have two files I would like to compare roughly. Each line of these files looks almost the same.

like image 766
LB40 Avatar asked Jul 07 '09 14:07

LB40


People also ask

How do I navigate splits in Vim?

To move between splits first press Ctrl-w (I remember this by Control Window, I'm not sure what the official mnemonic is) Then press a directional key to move the cursor to the split you're interested in. Directional key could be the arrows or my preferred home row method.

How do I open two vim windows side by side?

Splitting Vim Screen Horizontally To split the vim screen horizontally, or open a new workspace at the bottom of the active selection, press Ctrl + w , followed by the letter 's' .


1 Answers

Go to the first split, and type in

:set scrollbind 

Go to the next one (ctrl+w), and do the same.

To disable:

:set noscrollbind 

For more info, check the documentation for scroll binding - http://vimdoc.sourceforge.net/htmldoc/scroll.html#scroll-binding

like image 118
vyck Avatar answered Oct 16 '22 02:10

vyck