3

I am trying to yank from my cursor posintion to end of nth line defined by a motion. So for the below text

Lorem ipsum dolor sit amet,
consectetur adipiscing elit. 
Donec non quam et erat pharetra 
venenatis in non erat.

When I have cursor on dolor in first line, I want to yank from dolor to pharetra on third line.

My first guess was y2j will give the desired result. But it gives the same result as 3yy and it yanks the entire first line.

One alternate solution is to use v$2jy.

Is there a way to do equivalent of this in normal mode? Or remap y{n}j to v${n}jy?

2 Answers 2

3

I believe 3y$ will do what you want.

If you followed the suggestion in :help Y and did :map Y y$ you can use 3Y as well. I'm mentioning this because it's a common mapping.

1

Another version: from the beginning of dolor, y/pharetra/e<CR>

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.