jrock2004
jrock2004

Reputation: 3501

Vim delete up to X character

So I am trying to find the quickest way to delete up to the last period. My cursor would be on the first period, so I want to delete from the first period to the last one. Does anyone have any ideas?

#{customer.OrderHeader[0].BillingAddress[0].Line1}

Upvotes: 1

Views: 88

Answers (3)

Kent
Kent

Reputation: 195029

If you don't want to press . to repeat dt. many times,

E.g. there are 20 dots in the line. You can do:

v$F.hd

Upvotes: 1

benjwadams
benjwadams

Reputation: 1580

With cursor in place on the first period, type d/.*\(\.\)\@=

This should yield:

#{customer.Line1}

This uses lookahead to look from current cursor position up to any character followed by a period, but does not consume the final period.

Perhaps consider recording with q to make it easy to access as a macro.

Upvotes: 0

buff
buff

Reputation: 2053

First try: You can dt. and repeat the command once more by ..

You might also try JumpToLastOccurrence plugin

Upvotes: 1

Related Questions