On Apr 13, 1:15 pm, Christian Brabandt <cbli...@256bit.org> wrote:
>
> I think the easiest solution would be to use sed (or filter throught
> sed) like this:
>
> #v+
> chris...@t41:~/sed$ seq 1 10|sed '0~3a\> <inserted-text>'
>

I actually thing the easiest solution (though perhaps less elegant)
would be to use a macro:

Press qa to begin recording a macro into register 'a'.
Press 3j to jump down three lines.
Press o to open a new line and enter insert mode. Enter your text and
press the Esc key.
Press q to end the macro.
Type 999...@a to execute the macro until the end of the file.

This assumes that the text is the only thing in the file. It will also
need an extra blank line at the top of the file to work 100% correctly
without modification, but that should be fairly easy to achieve.

Instead of using a repeat count on the macro that is larger than your
file, you could also have used a recursive macro:

http://vim.wikia.com/wiki/Record_a_recursive_macro

But that's more for showing off than for any practical use that I've
ever found; the huge count works just as well in every real-world
situation I've found.

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to