Skip to content
Tags

, ,

Replace is Obsolete?

11/04/2012

Certainly, everybody has his habits in every aspect of his life. Editing a text or source file is no different. My case in this post is about using the Replace commands and facilities found at almost every modern editor or IDE. After reading this article, I finally realized how useless is the Global Substitute command found in Vim, the so called :%s//g command, an artifact of the old, line-oriented editors like ed.

In fact, it’s much easier and safer to find first the text to replace, edit it, and then by pressing n (find next) and . (repeat last change) to apply again the last editing change. This way it is possible to inspect each replace and perform this procedure very fast, when the changes are few. Most of the times this is the case. If the changes needed are more, then the global substitute command can be used as a last resort.

Advertisements

From → General, Programming

Leave a Comment

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: