In normal mode, I want to set a mark (ma) and then yank until the end of the line, including the last character ($ and y`a). But $ doesn't include the last character. What is the solution?

  • You could split the line where needed (i.e i<cr>) then yank it all (yy), which includes the carriage return, then undo the line split. So: i<cr><esc>yyu
    – Biggybi
    Nov 12, 2022 at 9:00

1 Answer 1


But $ doesn't include the last character.

$ does include the last character, it is `a that doesn't. :help mark-motions says that `a is exclusive, which is why the last character of the line is not yanked. See :help exclusive.

What is the solution?

Here are a few suggestions…

  • You could use visual mode, which is inclusive by default:

  • You could make use of the mechanism provided by Vim for momentarily forcing exclusivity or inclusivty, described under :help forced-motion:

  • Instead of placing the mark, then moving to the end of the line, then yanking from there to the mark, you could simply yank to the end of line without all those superfluous intermediary steps:


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.