Re: [dev] [vis] dw near the end of the line

From: Marc André Tanner <>
Date: Mon, 15 Feb 2016 16:38:23 +0100

On Sun, Feb 14, 2016 at 12:49:10AM -0500, Random832 wrote:
> Recently, the question of the correctness of vim's behavior of 2dw on
> the first of three lines of one word each came up on the vim mailing
> list (it turns out that it's not correct according to POSIX, but is
> shared with traditional vi).
> At that time, I wasn't able to build vis to see what it does. I've since
> figured out my build problem, and tested vis's behavior in this
> situation.
> When you delete the last word of a line in vis with the dw command, it
> always deletes the newline and all following spaces and newlines
> (i.e. placing the content of the next non-blank line on the current
> one). This behavior differs from most other vi clones, matching only
> elvis-tiny. Is this behavior intended?

Not sure, in practice vim's dw behavior is probably better in this case.
It was done that way in vis because it is easier to implement. There
are two main differences in this area:

 1) in vis a motion always works the same way independent of whether
    it was invoked in an operator context or not.

     $ printf "foo\n \nbar\n" | vim -

    In vim w will jump to the start of "bar", but dw will only delete
    the content of the first line "foo".

 2) an empty line is not considered a word by vis instead it skips to
    the next non white space symbol.

     $ printf "foo\n\nbar\n" | vim -

    In vim w will move to the empty line whereas in vis it moves to
    the start of "bar".

 Marc André Tanner >< >< GPG key: 10C93617
Received on Mon Feb 15 2016 - 16:38:23 CET

This archive was generated by hypermail 2.3.0 : Mon Feb 15 2016 - 16:48:10 CET