Quantcast
Channel: Debug Area » vim
Viewing all articles
Browse latest Browse all 3

vim replace text in files

$
0
0

To replace the text in multiple files, use the arg commands. First, set the files you’ll be working on, example:

:args app/views/**/*.erb

Then, run this command:

:argdo :%s/something/some_other_thing/ge | update

The g flag stands for “do all the replacements”, the e flag stands for “don’t show an error if match is not found”, and the update just writes the modified contents to disk.


Viewing all articles
Browse latest Browse all 3

Trending Articles