Search code examples
javascriptvimmotion

VIM: Cleaning up onclick events


I am doing some refractoring and one of the objectives is to move some inline js functions in HTML.

<a href="#" onClick="function('');">text</a>

The idea is to remove the onClick event along with the contents inside the quotes

<a href="#">text</a>

suggestions to move faster?

I would imagine after doing it one time I can just repeat the motion with . after finding the next instance.


Solution

  • A simple regex should do it:

    %s /onClick=".\{-}"//g