In normal mode, I want to set a mark (
ma) and then yank until the end of the line, including the last character (
$ doesn't include the last character. What is the solution?
$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
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
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: