There are 2 and only windows in vim. I want when I press F2, cursor remain in the same window, the other window behave like PgDnpressed.

How to achieve that behavior?


motivation: used in a preview mode, one window containing a dirvish buffer.

1 Answer 1


I think the following mapping should to the trick

nnoremap <F2> <C-w>p<C-f><C-w>p

It remaps F2 to change to the previously accessed window (:h CTRL-W_p), scroll down (:h CTRL-F) and come back to the previous window.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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