TIMEX
TIMEX

Reputation: 271634

In vim, how do I delete a word?

I have a big bear in my bed.

Suppose I have the cursor on "bear", in the "e" position, how would I delete the word "bear" completely?

Upvotes: 23

Views: 25514

Answers (4)

eckes
eckes

Reputation: 67047

As an alternative to larsmans answer, you could go back with b and then d elete everything un t il the next space: dtspace.

This mnemonic is more general and you could use it with several separators.

If you want to delete backward, use dTspace.

To learn more left-right-motions, ask for :he left-right-motions and read the end of the chapter.

Upvotes: 11

Luc Hermitte
Luc Hermitte

Reputation: 32926

diw/daw ! -> :h text-objects

Forget bdt/bdw here.

Upvotes: 9

vasuki
vasuki

Reputation: 516

You could maybe check this out.. delete word after or around cursor in VIM. Seems similar to what you need..

Normal mode:

    daw : delete the word under the cursor    
    caw : delete the word under the cursor and put you in insert mode

Upvotes: 40

Fred Foo
Fred Foo

Reputation: 363517

b to jump to start of word, then dw to delete current word.

Upvotes: 25

Related Questions