tags:

views:

60

answers:

2

I know that by typing the following: :%s/iwanthis/replacedbythis/g will change all the matching words of the file. How can I do the same for all the files within a folder?

(actually replacing a lot of words like this: padding-bottom:5px;)

+2  A: 

Open Vim with all the files loaded into buffers, and do the replace on all buffers at once with bufdo:

% vim *
... when vim has loaded:
:bufdo %s/iwanthis/replacedbythis/g | w

The | w will write each file back to disk.

Dave Kirby
A: 

you can try greplace.vim that can give you a buffer include all lines matching a given regex across multiple files, then you can modify things in the buffer, and then call another greplace command to make all the changes updated to all these files.

Vincent