Heath Borders
Heath Borders

Reputation: 32117

How do I use marks (not visual selection) to copy to the system clipboard on vim?

Most methods of copying to the system clipboard from vim involve using visual selection. I don't want to do that because I have to copy text that spans multiple screens. It's faster for me to use marks.

If I was just yanking the lines, I'd do:

/<<<<< # find the beginning of my diff
ma     # set mark `a` to the current position
/===== # find the end of my diff
y'a    # yank all lines between the current position and mark `a`.

I presume there's some way to y'a into a specific register, or transfer from the unnamed register to the selection register *.

Upvotes: 0

Views: 66

Answers (1)

romainl
romainl

Reputation: 196596

You can do:

:'a,.y *

or (shorter):

:'a,y *

See :help :y.

Upvotes: 1

Related Questions