klokop
klokop

Reputation: 2410

How to 'delete between and including quotes, but not leading/trailing whitespace'?

'bla bla bla', 'bla bla bla'
---------------^------------ (cursor position)

To delete the second 'bla bla bla' I use

da'

but this also deletes the leading space. Is there a way to not include the leading space in the deletion?

(I'm trying to create a macro to replace quoted strings with a function call, ie replace eg

'bla bla bla', 'woot'

with

yada('bla_bla_bla'), yada('woot') )

Upvotes: 0

Views: 48

Answers (2)

Kent
Kent

Reputation: 195049

in macro you can also use command, like this:

s/'.\{-}'/yada(&)/g

This will only apply on '...', the rest (space, comma etc) won't be touched.

Upvotes: 2

romainl
romainl

Reputation: 196546

You can use vi'i'<operator> to operate on the quotes and their content. This would make your macro look something like that:

vi'i'cyada(<C-r>")

Upvotes: 1

Related Questions