Thursday, February 4, 2016

Re: Feature or bug? dw oddities

On Thursday, February 4, 2016 at 6:31:03 AM UTC+1, Random832 wrote:

> Some interesting information:
>
> 1. Other vi implementations differ on how they behave here:
>
> - Elvis behaves the same way.
>
> - Heirloom vi behaves the same way. But *crashes* on some operating
> systems if asked to do this (it works on Ubuntu, but not Mac OSX,
> for me).
>
> - Most other vi implementations (nvi, vile, and Emacs' evil and viper
> modes) do not behave this way.
>
> 2. 2cw does _not_ delete the second linebreak, in any tested editor.
>
> 3. The POSIX vi standard specifies some distinction between 2cw and 2dw:
>
> - If there are <blank> characters or an end-of-line that precede the
> countth bigword, and the associated command is c, the region of
> text shall be up to and including the last character before the
> preceding <blank> characters or end-of-line.
>
> - If there are <blank> characters or an end-of-line that precede the
> bigword, and the associated command is d or y, the region of text
> shall be up to and including the last <blank> before the start of
> the bigword or end-of-line.
>
> (Reference to "bigwords" are because this is actually the description
> of the W command.)
>
> I _think_ that this is _not_ intended to imply vim's behavior, since
> the end-of-line is, at least in context, not a <blank>.


Thank you for the interesting input. I conclude you think the vim behaviour is at least disputable here. I keep this im mind for the future. For now I try to emulate Vim behaviour.

Obviously this is an example of

help: exclusive-linewise

That can be proved with, with cursor on X:

Xxx
xxx
xxx
xxx


With 2dw exclusive-likewise behaviour is used and the whitespace before X is deleted.
With 1dw neither whitespace nor line-break are deleted.

Elmar

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: