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


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 



How do I get Vim to automatically put ending braces?

1:



How do I disable the “Press ENTER or type command to continue” prompt in Vim?
I'm unclear where you're trying to insert the text in the buffer.


How do I set up different tab settings for different languages in Vim?
If you want it after the current line:.
How can I get a counter variable in Vim without python or ruby?
:argdo exe 'normal osometext' 
Inserting text with linebreaks in it:.
Unable to edit a title without opening a fold in Vim
:argdo exe "normal osometext\<CR>anewline" 


How to perform File Extension based Actions in VIM?


Unable to make gray eol character by .vimrc

2:



How to copy yanked text to VI command prompt
To append text after line nr 10:.
:argdo call append(10, "hello world") 
To append text to the line 10:.
:argdo call setline(10, getline(10)."textappended") 


3:


Yanking a text in vim will put it in the default buffer, which is ".

You can paste that buffer in insert mode for example by typing <C-R>".

So all you need is argdo put ".



85 out of 100 based on 75 user ratings 1225 reviews