Reputation: 469
I want to be able to take the following code
if ($something) { do something }
and make it
if ($somthing) { do something }
through out a whole file without really going to each statement and correcting it. I am not a regex guru so any help would be appreciated :)
Upvotes: 4
Views: 1480
Reputation: 9133
You can:
Search for a line that contains if
but doesn't end in {
:
/if [^{]*$
Join this line with the next one:
J
You can map this sequence to something:
nmap <F2> /if[^{]*$<CR>J
so that every F2 press will change the next if instance (100F2 will change 100 instances and so on).
Upvotes: 0