Here's a couple of alternative methods. They're
both a few more keystrokes than @statox's
but I think they're worth posting because they
show a few different techniques.
Visual block mode &
Like @statox, I'm presuming you start (on the
first character) of the 5th line for this
First we yank all the
x characters (but not the newline):
Then we delete the line:
Then we jump to the top of the file:
Then we enter visual block mode, and move down a line so the beginning of the start of both lines are selected:
Then we insert at the start of the visual block. When doing this, anything we insert will be inserted on both lines of the block.
Next, we enter the contents of the yank register by using insert mode's Ctrl-R feature. (See :help i_CTRL-R):
Finally, we leave insert mode:
So the complete set of commands is as follows:
Here's a method that only uses the command line. The following commands can be run with the cursor at any position.
First we move line 5 to the top of the file:
Then we create another copy of that line:
Then we join the lines up:
So, the complete set of ex commands is: