About

Swaroop C H is 29 years of age. He is a coder and startupper. He has previously worked at Yahoo!, Adobe, his own startup and Infibeam.

Read more about him

Views
Personal tools
COLLECTION
Collection

Talk:Vim en:Scripting

From Notes

Jump to: navigation, search

In the example on the Macros section you got this line:

   abul fazl is the historian

When you apply the macro to it, it doesn't exactly do what is intended to because the person has two names. It would require an extra w in the macro to make it work.

I think it would be just easier to change it to:

   abulfazl is the historian

Vim scripts without opening the file

Is there a way to run vim functions or commands on a file without actually opening it? This will be very useful when the number of files is large, but are of the same format, and a simple substitute command is needed. As an example, suppose I have 100 files names f001.txt to f100.txt. In each of these files, I want to change all occurrences of "AB" to "CD". Is there a way to run something like $ vim <???> '%s/AB/CD/g' f*.txt

Use `sed` in Linux -- Swaroop 20:16, 12 August 2010 (UTC)