Saluton Mahendra :)

On Fri 22 May 2009 08:46 +0200, Mahendra Ladhe <[email protected]> dixit:
>   I've opened say 20 files using one vim instance. I want to do the same
> sequence of operations on all files as below.
> 1. Replace occurrences of one word by some other word
> 2.. Save the file
> 3. Delete it from buffer so that some other file becomes current.
>
> Repeat above process till buffer becomes empty.
> Can I club all these actions at vim command line?
> something like
> :s/one_word/another_word/g;w;bd

You can do that with a macro, which probably is faster if you want to
run everything on 20 files (althoug maybe the faster way here is to use
sed). But if you want to execute multiple commands in one shot, you can
on Vim by using "|". Be careful, because some commands see "|" as their
argument and then the chaining won't work. See ":help :bar". For your
command:
:s/one_word/another_word/g | w | bd

Please note that if you want to perform the substitution on the entire
file, you have to use this:

:%s/one_word/another_word/g | w | bd

otherwise the substitution is done in the current line ONLY.

-- 
Raúl "DervishD" Núñez de Arenas Coronado
Linux Registered User 88736 | http://www.dervishd.net
It's my PC and I'll cry if I want to... RAmen!

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to