VIM^s#06 Delete or Change words within double quotes

Quite often we come across a situation like changing or deleting a string within double quotes especially when we are working with XML files, something as follows:

<property name="some.name" value="to.be.changed.or.deleted"/>

We know that if it is a single word, we could use dw or cw to accomplish what we need. But if the string is of multiple words or lengthier then the easier way to do is using,

d/pattern (or) c/pattern

In our case if have to remove the ‘value’ attribute’s string value, leaving the double quotes intact, all that I have to do is invoke the following command.

d/" [Enter] (or)  c/" [Enter]

This should do the trick. I know this is very trivial but believe me it could be a very handy at times.

 

 

Advertisements

About this entry