As a novice vim user, I used d[count]<Enter>
to delete lines.
It striked me as odd that there were always count+1 lines deleted.
If I wanted to delete 2 lines, I typed d1
, 3 lines took d2
, ...
I finally took the time trying to understand why and it appears I should have been using :d<count>
.
That does beg for the question though, why is :d1<Enter>
<> d1<Enter>
COUNT function counts cells that contain only numbers, but COUNTA function counts cells that are not blank, including numbers. As Date and Time values are stored as serial numbers in Excel so these values are counted in both of these functions.
COUNT: Counting all recorded values. DCOUNT: Counts only unique values.
d<count>
in normal mode doesn't do anything, because the count isn't followed by a motion. So presumably you've been hitting d<count><Enter>
, in which case the motion associated with d
is <count><Enter>
, which moves <count>
lines downward. Since <Enter>
is a linewise motion, the d
will also be linewise, deleting all lines from the current one to the line <count>
downward, inclusive.
The command you actually wanted is <count>dd
.
d{motion}
deletes the text that {motion}
moves over. When you type 3<ENTER>
, the cursor moves 3 lines below the current and therefore d3<ENTER>
deletes that area.
:d[count]
simply deletes [count]
lines.
The difference is that {motion}
is not the same as count
.
To get around that, you could use the visual
mode and select what you're going to delete and then simply press d
.
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