I'm learning vim with vimtutor. I was wondering if there is a difference between command motion number and number command motion.
For example:
2dw
seems to me to work exactly like d2w
, similarly 2dd
does the same as d2d
.
The two numbers are both called [count]
, in your example, indeed, they do same job. But the two counts come from different concept.
[count]command
this will do the command [count]
times, 2dd
does dd
twice; 2dw
does dw
twice.
The second is from the {motion}
, 2w
, 2j
etc.
If you want to see some differences, here are two I can think of:
{motion}
. For example, the X
, you press 2X
, will remove 2 characters before the cursor. However, you cannot do X{motion}
. other commands that don't support {motion}
p (paste)
, s
etc. You can do 2p
, 2s
, but you cannot do p2w
s3w
You get same result from 2dw
and d2w
, but the two 2
have different meaning, understanding what the number does is ok. you can combine the count and motion, like 2d3w
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With