Reputation: 910
I am learning Vim and I have come across this situation.
Hello, World!
-
I want to delete Hello, World
. If I entered bdw (go to beginning of word, delete word) three times then it would delete it. However, I want to type 3bdwto save typing, but it goes three words back and deletes that word, leaving me with , World!
. Is there any way to prefix a number to a three letter command or is there another command I should be looking at?
Upvotes: 2
Views: 160
Reputation: 17016
Is there any way to prefix a number to a three letter command or is there another command I should be looking at?
The problem is that it's not a 3-letter command, it's two seperate commands.
3b 3dw will do what you want, but it does require the extra 3.
EDIT: Years later... I notice a small optimization to this case w3db. The only small issue is that you need that leading w to correct the cursor position.
Upvotes: 2
Reputation: 20554
Move the cursor under the ! ($ or l)
Then write d0 (which means delete til beginning of line)
You can also do 0 (go to beginning of line) then dt! (delete until next !
)
Upvotes: 0
Reputation: 7941
Hello, World!
Go to the beginning of line (by pressing 0) and type the following:
dt!
Explanation:
d delete
t until the character before !
in the line.
Upvotes: 1
Reputation: 160833
Move the cursor under !
, then press
dFH (delete back until first H
)
F=Shift+f
Upvotes: 3