Say I have two windows open, and I would like to copy lines from the first window to the second window, and then move back the original window. I do this as follows:
<select lines in Visual mode>
y
Ctrl+w
w
p
Ctrl+w
w
I would like to map this to a key. My attempt is the following:
:map <F2> y :wincmd j<CR> p
It successfully copies the lines from one window to the other, but I can't seem to successfully make it jump back up to the previous window. How can I add this next part? The following does not work:
:map <F2> y :wincmd j<CR> p <ESC> :wincmd k<CR>
<C-w>p
and:wincmd p
when you read:help window-move-cursor
?