This sounds like a good use case for a macro. Macros are commands that can be recorded and stored in a Vim register. Each register is identified by a letter from a to z.
From Recording keys for repeated jobs - Vim Tips
To start recording, press q in Normal mode followed by a letter (a to z). That starts recording keystrokes to the specified register. Vim displays “recording” in the status line. Type any Normal mode commands, or enter Insert mode and type text. To stop recording, again press q while in Normal mode.
For this particular macro, I chose the
m (for move) register to store it.
I pressed qm to record the following commands:
- dd to delete the current line (and save it to the default register)
- CtrlWj to move to the window below
- p to paste the contents of the default register
- and CtrlWk to return to the window above.
When I typed q to finish recording the macro, the contents of the
m register were:
- To move the current line, simply type @m in Normal mode.
- To repeat the macro on a different line, @@ can be used to execute the most recently used macro.
- To execute the macro 5 times (i.e., move the current line with the following four lines below it), use 5@m or 5@@.