November 2018
Beginner
330 pages
7h 21m
English
Oftentimes, we rename things when refactoring, and these changes need to be reflected throughout the code base. However, simple search and replace often won't cut it, since you'll risk accidentally renaming unrelated things.
For example, let's try renaming our Dog class as Pitbull. Since we need to carry this out in multiple files, we'll use arglist:
:arg **/*.py
Now, move your cursor over the class name you'd like to rename (Dog), and enter the following(here, \<[Ctrl + r, Ctrl + w]\> signifies pressing Ctrl + r followed by Ctrl + w and not typing in square brackets):
:argdo %s/\<[Ctrl + r, Ctrl + w]\>/Pitbull/gec | update
Once you run it, you'll be prompted for every match:
Press y to approve ...
Read now
Unlock full access