In VIM, why does `db` not delete the character under the cursor?

I read that it bis similar to the opposite value e, i.e. bdoes what e does, but vice versa.

So, if I click d eon a word and the cursor on the first letter of a word, it will delete the whole word. It's great!

But if I click d bon the word, and the cursor is on the last letter of the word, it will delete the whole word, except for the letter in which the cursor was!

I know that I could just move one character at a time b, but I would like to maintain consistency. And maybe someone could tell me why it bbehaves this way.

+5
source share
4 answers

vim - , - . / , , "on" k bark, d b, r b.

, -

+5

b e, b , e . :help e :help b:

e [count] . .

b [count] . .

:help exclusive:

, . , . , . .

+9

You should take a look at :help text-objects: it allows you to apply commands to intelligent objects, such as words, sentences or paragraphs.

You must use to erase a word, regardless of the position of the cursor d i w.

+1
source

Delete a word d a w.

Deletes the word under the cursor and the space on the left, leaving the cursor at the end of the previous word. This is a repeatable change. In VIM, you can repeat with.


$| Then there was noe

d a w| Then was

.| Then there

0
source

All Articles