News for hackers. Stuff that matters.
Re:Vimflowy by rav on Wednesday November 04, 2020 @01:15PM (#24991527)
Just like any other sort-of-Vim implementation, cw (change word) is made to be consistent with dw (delete word), and Y (yank line) is made to be consistent with D (delete line). In classic vi, these commands are illogical in that cw doesn't eat the space following the word like dw does, and Y works on the entire line, whereas D deletes only from the cursor to the end of the line. The Vim manual states that:

     If you like "Y" to work from the cursor to the end of line (which is more logical, but not Vi-compatible) use ":map Y y$".
...however, I'm used do cw and Y being illogical like that, goshdarnit, so when these Vim-clones come along and "fix" it, I'm thrown off at every step I take.
Re:Vimflowy by darrenf on Wednesday November 04, 2020 @02:24PM (#24992175)
I’ve never found the cw/dw case illogical. When I’m deleting a “word” (in prose or code) it’s rarely, perhaps never, my intention to leave a double space between the surrounding words. But if I am changing one, the likelihood is that I’ll want to trailing space to remain after I type the replacement.

So whilst I see nothing illogical, I’m in agreement that a change to these commands would throw me!

Re:Vimflowy by ysavir on Wednesday November 04, 2020 @02:42PM (#24992354)
It's practical, but it's not logically consistent with what's considered a "word" in Vim. "Delete word" and "Delete until next word" are two different functionalities, so there's an inconsistency when a function shortcut is named to represent the former, but behaves like the latter.
Re:Vimflowy by wraithy on Wednesday November 04, 2020 @03:19PM (#24992670)
There's always "ce" (change until end of word), which enables the common use case and is also consistent with the rest of the vim language.

I wonder why the special case for "cw" exists... I'd love to hear the story about that initial decision.

Re:Vimflowy by boogies on Wednesday November 04, 2020 @05:08PM (#24993543)
I'd guess just because cw is much easier/faster to type (because c and e are pressed with the same finger) on a QWERTY keyboard.
Re:Vimflowy by mkl on Wednesday November 04, 2020 @07:46PM (#24994632)
Not if you're touch typing with any standard fingering I've seen. C is first finger, and E is middle finger.
Re:Vimflowy by michaelcampbell on Wednesday November 04, 2020 @08:08PM (#24994736)
You might need to look around more. The wikipedia article shows 'c' on the middle finger, like I was taught. I can't imagine doing it with the first finger, but I suppose it just depends on how you were taught.

Looking around, I can't even FIND a "c on first finger" fingering.

- https://en.wikipedia.org/wiki/Touch_typing#/media/File:Finge...

- http://www.typingme.com/touch-typing/typing-lesson-9.php

- https://agilefingers.com/articles/touch-typing-finger-placem...

- https://www.computerhope.com/issues/ch001346.htm

- https://www.ratatype.com/learn/

and on and on.

Re:Vimflowy by ybbond on Thursday November 05, 2020 @01:13AM (#24996043)
I did watch me and my friends' touch typing behavior, and most of us use left index finger for RFCVGT(B), and right index finger for YUHJ(B)NM. the character in parenthesis means it overlaps between right and left area
Re:Vimflowy by mkl on Thursday November 05, 2020 @01:57AM (#24996195)
That's what I do. I'm clearly wrong about the fingering charts though (I learned from an ancient DOS program, so I can't check that one). I have a picture of a symmetrical one in my head; C is the equivalent of M, so it seems like they should use the same finger.
Re:Vimflowy by oogetyboogety on Wednesday November 04, 2020 @08:30PM (#24994870)
Didn't even realize I use index finger for c until you mentioned it. Turns out I should be using my E/middle finger. Hm.
Re:Vimflowy by kps on Wednesday November 04, 2020 @05:36PM (#24993763)
`cw` and `ce` don't do the same thing if you're on the last character of the word.
Re:Vimflowy by nightcracker on Wednesday November 04, 2020 @06:03PM (#24993977)
ciw does, and is what most people really want to begin with.
Re:Vimflowy by kps on Wednesday November 04, 2020 @06:39PM (#24994216)
`ciw` is a vimism, though.
Re:Vimflowy by v-yadli on Wednesday November 04, 2020 @01:20PM (#24991562)
I usually think of cw vs. dw as changing the data in a node vs. removing a node (together with its next pointer), in a linked list.
Re:Vimflowy by timoth on Wednesday November 04, 2020 @04:07PM (#24993079)
Interesting. I never use Y or D, I use yy and dd which both operate on the entire line. I like that they're lower case and 'fit' in my mind with their other 2 character counterparts, yw, dw etc. (and I use d$ for delete to end of line).
Re:Vimflowy by boogies on Wednesday November 04, 2020 @05:17PM (#24993618)
Not every sort-of-Vim implementation (ofc). I use vis¹, which has the classic cw, but the consistent Y.

And I prefer it the vis way. cw is a binding I use often, and more pleasant to type than ce. yy I also use fairly frequently, but Y is not much more pleasant, and y$ is much less pleasant, and I copy from the cursor to the line end often enough to want it to be easy, quick, and feel nice.

¹: https://sr.ht/martanne/vis/

Re:Vimflowy by krick on Wednesday November 04, 2020 @03:45PM (#24992874)
I have absolutely no idea what people are talking about in this thread. I never noticed any of this, and even went right now to test it on Vim 8.0, and nothing of what you are saying seems to be correct. I have quite a big .vimrc, but I don't think I re-configured any of this. Maybe all of it applies only to vi, not vim?
Re:Vimflowy by umanwizard on Wednesday November 04, 2020 @06:51PM (#24994316)
Try with `vim -u NONE` to ignore your .vimrc .

If the buffer is “asdf jkl” with your cursor at the beginning of the line, after dw the buffer is “jkl”. With the same starting buffer, after cw, the buffer is “ jkl”, with a space at the beginning (which is the same behavior as ce).

This “inconsistent” behavior is probably what you usually want, but it does indeed break the invariant that c<motion> is equivalent to d<motion>i .

Re:Vimflowy by chrismorgan on Thursday November 05, 2020 @01:41AM (#24996138)
> the invariant that c<motion> is equivalent to d<motion>i

Nit: that invariant also doesn’t work when the motion takes you to the end of the line because of how the cursor is one character wide in normal mode and zero characters wide in insert mode. On a buffer “asdf jkl” with the cursor on the letter f, c$x gets you “asd|” (| representing the cursor location), whereas d$ix gets you “as|d”.