Why Y command doesn't work like yy, but works like y$? I mean, everyone says that it does work like yy, but for me, it doesn't. So how do I fix it?

For the close reason: This question doesn't help me. I'm asking the opposite question, about why for me, Y works like y$ on my machine instead of yy, and not why Y works like yy instead of y$.

  • @Mass No, it's the opposite of this question, Everyone seems to say that Y works like yy instead of y$ and I have no clue why.
    – Fmbalbuena
    Dec 9, 2023 at 22:05
  • 1
    hmm perhaps you're using neovim? neovim.io/doc/user/change.html#Y-default
    – Mass
    Dec 10, 2023 at 2:44
  • 1
    @Mass Yes... I'm using Neovim.
    – Fmbalbuena
    Dec 10, 2023 at 15:44
  • 1
    The Neovim team has made the choice to follow the doc suggestion and provides a default mapping of Y to y$. More information with :help Y or :help default-mappings. Dec 12, 2023 at 6:33
  • 1
    Well then, I added the neovim tag and voted to reopen. Vivian's comment above should already be the answer you're looking for. On a side note, :help Y explains what's going on for both Vim and NeoVim.
    – Friedrich
    Dec 12, 2023 at 7:25

3 Answers 3


Just to finally collect all our misunderstandings about the question: the OP is using neovim which makes Y act more like C/D by default. This is apparently still documented at :help Y, and could be switched (if desired) by a similar mapping as that of many Vim users:

nnoremap Y yy

(I can't think why you would need bare map here, but I'll correct it if someone can point out what I'm missing.)

  • Bare :map is what Bram wrote into :help Y almost 20 years ago. I quoted it but I don't think it's needed. I also like how this "fix" restores inconsistent behavior from the 1970's. To each their own.
    – Friedrich
    Dec 12, 2023 at 18:04
  • @Friedrich, yes, I recognized the quote :) I suggest it be updated, though.
    – D. Ben Knoble
    Dec 12, 2023 at 18:29

As D. Ben Knoble already said in his comment, :help Y says:

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$".

From this, we can infer two things:

  • it was a well-known incompatibility that compelled somebody to explain it, including a workaround.
  • it wasn't important enough to be added to cpoptions.

Coming back to your question, for Vim the answer is "Vi-compatibility" and you can add the mapping above to your vimrc.

For the original Vi, I don't know the answer.

Based on gut feeling, I would say I'd use yy more frequently than y$ so that may have been the reason for giving it a one-letter command. This, however, is just my theory.



In Vi, Y is "yank current line", while C and D are "change to end of line" and "delete to end of line", so we have had that mess for a long time.

I don't think I've read a definitive explanation of that discrepancy anywhere but I find the hypothesis that Y (really Shift+y) was more practical than y_ (really y then Shift+-) for a very common action unconvincing. Yes, that's fewer keypresses but C and D don't work like Y despite "change current line" (c_) and "delete current line" (d_) certainly being as common as "yank current line" and certainly more common than "change to end of line" and "delete to end of line".

It is just some arbitrary mess that has been passed on from generation to generation for decades.

Being a Vim clone at its heart, Vim kept the original incoherent meaning of Y, C, and D but the author was aware that it was silly so you get the little mapping suggestion under :help Y.

Note that Y was really cheaper than y_ in Vi so it made kind of sense in the original context. But Vim has yy (and cc and dd), which is a lot efficient than both Y and y_, so the suggested mapping brings some much needed consistency without hurting anyone:

  • use Y, C, and D to operate "to end of line" (less efficient, for a less common action),
  • use yy, cc, and dd to operate on "current line" (more efficient, for a more common action).
  • "Arbitrary mess" sounds just as convincing as my own pet hypothesis. It's also a good short description for virtually every software project I ever worked on.
    – Friedrich
    Dec 9, 2023 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.