Vim can I scroll up / down an inactive window?

I split my window into 2 windows. And I need to scroll the inactive window. Example for scrolling the preview window up and down without placing the cursor in the preview window.

+7
source share
2 answers

You can add a couple of user mappings:

:nmap ,d <CW>W<CD><CW>W :nmap ,u <CW>W<CU><CW>W 

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

+5
source
 "this function maps Alt-down and Alt-Up to move other window " put in your ~/.vimrc fun! ScrollOtherWindow(dir) if a:dir == "down" let move = "\<CE>" elseif a:dir == "up" let move = "\<CY>" endif exec "normal \<CW>p" . move . "\<CW>p" endfun nmap <silent> <M-Down> :call ScrollOtherWindow("down")<CR> nmap <silent> <M-Up> :call ScrollOtherWindow("up")<CR> 
+1
source

All Articles