IttayD
IttayD

Reputation: 29153

Vim - delete until (inclusive) character in multiple lines

I have this code:

def foo(c: Char) = c match {
    case 'a': 'B'
}

My cursor is on the space after =. I want to delete everything until, including, the }. How can I do that?

Can I do the same where the cursor is anywhere on the first line? Anywhere in the block (and place the cursor after the =)?

Upvotes: 26

Views: 15923

Answers (4)

Matt
Matt

Reputation: 4999

You can achieve something like this with the EasyMotion plugin.

Upvotes: -3

cforbish
cforbish

Reputation: 8819

This should work:

d}

This deletes one paragraph forward.

Upvotes: 6

romainl
romainl

Reputation: 196826

d/}/e

does the job.

d/} deletes until the } but adding the /e flag moves the cursor on the last char of the match, effectively deleting everything between the cursor and the }, inclusive.

Using visual selection works too, in a slightly more intuitive way:

v/}<CR>d

Upvotes: 40

Pablo D&#237;az Ogni
Pablo D&#237;az Ogni

Reputation: 1043

Try with this: d%.

The d is for delete and the % moves between braces.

Upvotes: 28

Related Questions