Thursday, February 11, 2016

Re: Feature or bug? Funny behaviour of cw on whitespace.

On 11.02.16 03:43, 'Elmar Hinz' via vim_use wrote:
> the normal behaviour of the w motion is to move n words forward and to act exclusively.

Yes, the motion is (mostly) to the start of the next/nth word. (exclusive)

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

Ah, I don't ever use cw within a word, but ce instead, so haven't
noticed that it fails to eat the space as it should, to be consistent.
But ":h cw" opens with a defence of this "Special case: ...change-word".

> But what happens when hitting cw on whitespace between words?

The w motion is then perfectly as specified, and as expected.
It is particularly handy when correcting indentation of a few
lines to align with a leading line of arbitrary indentation:

1) Move to start of leading line, with ^.
2) j
3) dw
4) Loop to 2 until done, using '.' at 3, i.e. j.j.j.j.


Erik

--
--
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: