Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

in vim, how to append/insert text with argdo?

There's the ":a" command, but that's multi-line, and argdo asks you for the text again for each file.

The docs mention the global command (g/pat/command) that will use an alternative version of ":a" that is terminated by a newline instead of by "." on a line (you can include newlines by escaping them with "\"). But I couldn't get this to work.

The only way I've seen is to first yank the text-to-be-added into a named register, then use:

:argdo put x                 " where x is the register

I'm hoping for something like

:argdo append myTextHere
like image 474
13ren Avatar asked Jun 23 '09 16:06

13ren


1 Answers

I'm unclear where you're trying to insert the text in the buffer. If you want it after the current line:

:argdo exe 'normal osometext'

Inserting text with linebreaks in it:

:argdo exe "normal osometext\<CR>anewline"
like image 133
Brian Carper Avatar answered Oct 11 '22 16:10

Brian Carper