I ran the following sequence of commands:
V10j
⌘ c
but it seems like this doesn't copy the ten lines to my clipboard. So how can I do this?
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityI ran the following sequence of commands:
V10j
⌘ c
but it seems like this doesn't copy the ten lines to my clipboard. So how can I do this?
Vim uses registers to store text. It may be helpful for you to read :h registers
if you haven't already, as well as the user manual (this is covered in section 04.7)
Assuming you are using a version with the clipboard feature compiled in (which the default vim version on macOS as well as homebrew has), you can use the *
register. So for your visual mode selection you would do:
V10j"*y
Note that this can also be achieved in normal mode without entering visual mode by doing "*y10j
.
"
is like: "select this register" (in fact you can choose the a, b, c, d, etc. register to copy your text)
– Fabrice Hategekimana
Jan 5 at 11:07