How to delete 4 words before the cursor in vim?

I would also like to know if there are other ways to delete 4 words after the cursor.

I know 4deand 4dwdelete 4 words after the cursor, and 4dbdeletes 4 words before the cursor, but when I am in the middle of the word, as shown below:

// SO|ME RANDOM CODE HERE

result of performing 4deand 4dwis:

// SO|

instead of deleting all 4 words.

Thanks for any help!

+4
source share
1 answer

4dwdeleted using text movement: it four times "removes from here to where I jump on w", which four times removes the end of the word.

Instead, use text objects: 4dawfour times “deletes a word” or deletes four words.

+11
source

Source: https://habr.com/ru/post/1535883/


All Articles