Consider the following text snippet:
value1,
value2
Now, if the cursor is at (1,1)
(the 'v'
of value1
), W
takes me to (2,5)
(the 'v'
of value2
) which is as expected. But if I do dW
at the same position, what I expect is:
value2
But what I get is:
<empty_line>
value2
From :h exclusive
:
Which motions are linewise, inclusive or exclusive is mentioned with the
command. There are however, two general exceptions:
1. If the motion is exclusive and the end of the motion is in column 1, the
end of the motion is moved to the end of the previous line and the motion
becomes inclusive. Example: "}" moves to the first line after a
paragraph,
but "d}" will not include that line.
exclusive-linewise
2. If the motion is exclusive, the end of the motion is in column 1 and the
start of the motion was at or before the first non-blank in the line, the
motion becomes linewise. Example: If a paragraph begins with some blanks
and you do "d}" while standing on the first non-blank, all the lines of
the paragraph are deleted, including the blanks. If you do a put now, the
deleted lines will be inserted below the cursor position.
I am not sure if either of the exceptions applies to my case. What's going on?
:version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jan 9 2018 04:14:45)
Included patches: 1-662
Modified by <bugzilla@redhat.com>
Compiled by <bugzilla@redhat.com>
Huge version without GUI. Features included (+) or not (-):
...
dw
also has the same issue. Surprisingly, however,dB
anddb
work as expected.