vim: replace all characters up to a given token

Viewed 11276

Using vim I would like to replace all characters up to a certain one with another character, say a blank space - without affecting the layout/number of characters in the line. Here's an example:

Before:

real(kind=R12), intent(out) :: my_var

After replacing , intent(out) with blanks (i.e. starting from ,, and going up to )):

real(kind=R12)              :: my_var

I know about r to replace one character, and about nr to replace n characters, but I would like to know whether I can accomplish my task without first having to count the characters I want to replace.

Thanks a lot for your replies!

4 Answers
Related