making each line double vim
alternatively you could apply a macro
yypha"<esc>^iecho "<esc>j^icat <esc>j
yypha"
yanks the current line puts it below the current and go up withh
a"<esc>
appends a"
and goes back to normal mode^iecho "<esc>
putsecho "
in front of thefile*
and again goes to normalj^icat<esc>
prepends cat on the next line andj
at last goes to the next line to be ready for reapplying the macro
you can either record the macro by pressing qq
and the buttons as described or
write yypha"^[^iecho "^[j^icat ^[j
with ^[
being entered as Ctrl-V
then Esc
and then "qyy
to yank the line in the q-th register, which is then also an executable macro.
The macro itself you can run with @q
once or 30@q
thirty times.
I'd usually go with the accepted answer, but just to show that command-mode (Ex) commands can be nice too:
:g/^./t. | norm!
icat␣
^Ok
^O0echo␣"
^OA"
Note: enter the keycodes using ^V (e.g. ^V^O). On windows, ^Q has that function by default)
Explanation
:g/^./
(repeat for every line containing at least one char)t.
(duplicate the line below)the rest:
- insert `'cat ``,
- ^O
k
(up a line) - ^O
0
(at start of line) - insert
'echo "'
- append
'"'
at end of line