Hacker News new | past | comments | ask | show | jobs | submit login

This has some mistakes. yt$ is not equivalent to yy - yt$ yanks from the cursor to the end, yy is equivalent to 0yt$

Actually it's even bigger than that. yt$ does not include the newline, yy does. So p after a yt$ will not change lines, it will insert the content directly on this one after your cursor, while p after a yy will reproduce the entire line as a new line below the current one.

Are you sure that yt$ will do anything if there is not a dollar-sign character on the line? Neither that or ct$ seem to do what the post advertises.

y$ will yank till the end of line (characterwise). Y is actually the same as yy, unless you n(no)remap Y to be the same as y$, which most people do. This makes make more sense, because C is the same as c$ (change till end of line). ':h change.txt' explains all of this and more a lot better than I could.

thanks guys, I wrote the post at 3am and that was a bad time to be writing about vim as it turns out :) I've removed the bad examples for now and will go back to the post and add more as I think of them. The general idea was to explain that vim is not voodoo, but is very mnemonic and conversational.

The commands the OP was looking for was c$ and y$. They are equivalent to say cw, where the object is "end of line" instead of "current word"

There's another mistake in that command (also present in the article): with that "t" in there, `yt$` will yank up to, but not including, a '$' character on the current line. Unless there is no '$', which is an error and no yanking. Yank from cursor, not including newline, is `y$` without a "t".

and capital Y is equivalent to y$. A capital letter for a verb is "do this verb from current location until end of line"

Y is an exception to that rule, it's a synonym for yy (like S for cc), but easily changed to match D and C.

Ah wow, you are correct. Any good reason that is the default behavior for Y?

Applications are open for YC Winter 2020

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact