Checking as you substitute
What would you do now if you want to change the variable i into
a k? You can't just use an instruction like
:254,267s/i/k/g
because that will change the letter i into k even
in other words like int and list.The solution to this is to add a c (for check) after the s command. For example,
:s/pattern/replacement/gc
When you do this, vi checks with you before making
every substitution. Before each possible change, vi prints
the line at the bottom of your screen and puts a ^ under
the string that might be changed. If you want the change to happen,
press the <Y> key followed by <Enter>. If you do not want the change
to happen, press the <N> key followed by <Enter>.