November 2018
Beginner
330 pages
7h 21m
English
Vim supports search and replace through the :substitute command, most often abbreviated to :s. By default, :s will replace one substring with another in a current line. It has the following format:
:s/<find-this>/<replace-with-this>/<flags>
The flags are optional, and you shouldn't worry about them for now. To try it, open animal_farm.py, navigate to the line containing cat (for example, with /cat), and execute the following:
:s/cat/dog
As you can see in the screenshot, this replaces the first occurrence of cat in the current line:

Now, let's look at the flags you can pass to the substitute command:
Read now
Unlock full access