Basically :.s/ /
SpaceCtrl+vEnter/g
Enterjma:.s/ /
Ctrl+vEnter/g
EnterCtrl+v'axgg$p'adG
will do the trick. :)
OK, let's break that down:
:.s/ /
Ctrl+vEnter/g
Enter: On the current line (.
), substitute (s
) spaces (/ /
) with a space followed by a carriage return (SpaceCtrl+vEnter/
), in all positions (g
). The cursor should now be on the last letter's line (e
in the example).
j
: Go one line down (to A B C D E
).
ma
: Set mark a
to the current position... because we want to refer to this position later.
:.s/ /
Ctrl+vEnter/g
Enter: Do the same substitution as above, but without the Space. The cursor should now be on the last letter's line (E
in the example).
- Ctrl+v
'a
: Select from the current cursor position (E
) to mark a
(that we set in step 3 above), using the block select.
x
: Cut the selection (into the "
register).
gg
: Move the cursor to the first line.
$
: Move the cursor to the end of the line.
p
: Paste the previously cut text after the cursor position.
'a
: Move the cursor to the a
mark (set in step 3).
dG
: Delete everything (the empty lines left at the bottom) from the cursor position to the end of the file.
P.S. I was hoping to learn about a "built-in" solution, but until such time...