Reputation:
I have the follow code:
@synthesize property1;
@synthesize property2;
@synthesize property3;
@synthesize property4;
I want them to end like
@synthesize property1 = _property1;
@synthesize property2 = _property2;
@synthesize property3 = _property3;
@synthesize property4 = _property4;
I'm using Vim and have been trying to come up with a solution that will math the property name between the space and ;
, but everything I've tried gives me a match including the two delimiters.
Upvotes: 1
Views: 138
Reputation: 42026
That’s the most minimal one that will work I guess:
:1,4s/\([a-z0-9]\+\);/\1 = _\1;/g
Note that 1,4
is the range of lines on which to apply this search and replace command.
More details can be found on http://vim.wikia.com/wiki/Search_and_replace
Upvotes: 2
Reputation: 28934
A concise substitution command can be used to solve the issue:
:%s/@synthesize \zs\w\+/& = _&/
Upvotes: 2