set chars to uppercase between parenthesis

Posted by emzap79 on Super User See other posts from Super User or by emzap79
Published on 2014-06-05T20:27:22Z Indexed on 2014/06/05 21:28 UTC
Read the original article Hit count: 175

Filed under:
|

let's assume in vim I have following lines:

all what (strong) people have to do is pushing (heavy) weights

over (and over) again in order to gain muscles

and I need to convert words inside parenthesis to uppercase, what is the most convenient way to do so? How do I tell vim it needs to select everything to the first (!) closing parenthesis? So far I came up with

:%s/\s(.*)\s/\U&/g

unfortunately this will uppercase everything between 'strong' and 'heavy' which is not what I want. Any chance to tell vim it should select the chars to the next closing bracket only? (sorry for the silly example, couldn't think of something more sophisticated... or at least vim related... huh)

© Super User or respective owner

Related posts about vim

Related posts about regex