Thursday, February 11, 2016

Feature or bug? Funny behaviour of cw on whitespace.

Hello,

the normal behaviour of the w motion is to move n words forward and to act exclusively.

Different from this the normal behaviour of cw is to change to the end of the current word, much like ce.

But what happens when hitting cw on whitespace between words?

(I start vim as "vim -u NONE" to exclude influences of personal settings. Right?)


Case 1: cw

It replaces the current space and switches to insert mode. It doesn't ask for word boundaries at all. So it differs from the default w motion in this.

Case 2: 2cw

On contrary this one follows strictly the default w motion. The motion replaces forward all up to two words but excludes the beginning of the target word.

Result is, that a command telling to change 2 words is changing 2 whitespace regions with one word in between, what feels very funny.


Both cases behave not the way, I would intuitively expect. That makes it more surprising, that they differ in behaviour.


What would I intuitively expect?

* 2cw on whitespace: Change up to the end of 2 words forward.
* 2cw in word: Change from beginning of first word to the end of second word.


Again my question are:

* What is the reasoning for this behaviour?
* Is it for reason of vi compatibility (only)?
* Is there a consensus, that this oddity would ideally to be improved?
* If so, is there a roadmap to an improved version, a kind of VIM2 "oddity cleaned"?


Kind regards,


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: