Override vim command for yank

The shortcut Y for some reason does not control the way D and C do. Instead of pulling from the current position to the end of the line, Y yanks a whole line. Y does the same as yy.

Is it possible to override this functionality? I want Y to act like y $

+4
source share
2 answers

Learn how to search for commands and navigate through the built-in :help; It is comprehensive and offers many tips. In connection with your question, :help Ysuggests the following:

If you like "Y" to work from the cursor to the end of the line (which is more logical, but not Vi-compatible) use :map Y y$.

+3
source

Use the card in normal mode:

:nnoremap Y y$
+4
source

All Articles