Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I scroll the file up or down in an inactive window in Vim?

Tags:

vim

scroll

Say, I split my Vim screen into two windows. And I need to scroll inactive window. Example to scroll up/down preview window without placing a cursor into preview window.

like image 965
RusAlex Avatar asked Feb 04 '11 09:02

RusAlex


People also ask

How do I scroll up and down in Vim?

You can make Vim scroll the text using the shifted up/down arrows by mapping Shift-Up to Ctrl-Y and Shift-Down to Ctrl-E. Shift-Down will then scroll down (like moving a scroll-bar down, or like moving a cursor at the bottom of a window down), and Shift-Up will then scroll up (like moving a scroll-bar up, etc).


1 Answers

You could add a couple of custom mappings:

:nmap ,d <C-W>W<C-D><C-W>W
:nmap ,u <C-W>W<C-U><C-W>W

and then use ,d and ,u to scroll down and up in the other window.

like image 86
DrAl Avatar answered Nov 02 '22 00:11

DrAl