Archive for the ‘search’ tag
Today, I tried to find a convenient way to unify the spelling of a word used in various text files spread across multiple directories. Of course vim has a solution to this. In my case all files are of type *.txt. The term I want to search for is “re-use” which should be replaced by “reuse“. Here is what I did:
- Open vim while loading all relevant files recursively as a argument list the editor.
- Start recording a macro in register “a”. Type
- Enter the substitution command to search and replace a specific character pattern
- Change to the next file in the argument list. Type
- Stop recording the macro in register “a”. Press
- Playback the macro 999-times by entering.
The posts “Vim 101: Search and Replace on Multiple Files” and “Vim. How to replace a word (string) in several files.” guided me. Please have a look there for further information.