 Okay, so this video is going to be on how to copy things from VIM to another program or vice versa. Let's say you have some code in VIM you want to copy to Firefox or some stuff on Firefox you want to copy to VIM or maybe something you want to copy between two VIM windows or some other program, how do you actually do that? Because if you're a VIM user and you know the basics, you know that VIM is very good at, you know, I can yank up this line, paste it a million times, it's very nice to be able to, you know, yank two words, paste those words out, etc. Copying and pasting is very nice inside of VIM, but how do you actually copy things to other programs? Okay, so I'm going to tell you how to do that in this video. Before I touch directly on that, you should know what is actually going on under the surface and that is what are registers in VIM. So the thing about VIM is you can, of course, copy things with why and you can paste that out. But of course, that's only going to refer to the last thing you have yanked, the last thing you've copied. But VIM has this very nice ability to copy things to particular registers. Now, registers are just little storage places where you can have, you can yank text and keep it for later. And each letter on your keyboard corresponds to a particular register. So I can save this line here to the A register. Now, how I do that, let's say I highlight this with capital V. I can save it to the A register by doing quotation mark, A, and then Y for yank. Or I can save this line to register B by saying quotation mark B and then Y for yank. Now we have saved both of these different lines to different registers. Now I can paste these out. In fact, I can paste them out in a different order. If I want to paste them out, you just again use quotation marks to access the register, the register you want to access, and then P. So now I've pasted out the stuff in the B register right here. And I can paste out the stuff in the A register as well by doing quotation marks, A, and then P. So that's how registers work. If you want to have all these different things saved to different registers, it's very easy to do in VIM. Now that we've said that, how do we actually do what we want to do? How do we copy from VIM to, let's say, another VIM window or a browser or something like that? I'll go ahead and pull up my browser. So let me skip to the actual use case. So let's say we have this line here and we want to copy it into our browser. How do we do that? Now by default, VIM doesn't have this ability to access your system clipboard. But getting this ability is actually extremely simple. If you know what you're doing, you can just compile a version of VIM that has this. But if you don't know what you're doing, or if you're like me and you're lazy, you can just install GVIM. Now what GVIM is, I'll pull GVIM up just to show you. GVIM is just a graphical version of VIM. Now you don't have to use this. I don't use it at all myself. This is the first time I've opened it. But the thing about GVIM is when you install it, it gives VIM generally the ability to copy to a special register. That corresponds to your system clipboard. So I'm going to close out of this thing and probably never open it again. But GVIM has given me the ability, since I've installed it, to use the plus buffer. Now the plus buffer is really just, or not buffer, plus register. The plus register is a register you could copy things to and that will automatically put it in your system clipboard. So I'm going to control V to highlight this line. And I'm going to do quotation mark to pick a register plus to pick that register. And then Y to yank. So I've now yanked this into that register and I can go to my browser and press control V the same way you would normally and see that it is now pasted in. And I can go to this site, I can get whatever I need. And let's get something from here. Let's say list explicitly installed packages not in base with size and description, okay, this is a nice line. I'm going to copy this the same way that I do normally. And I can now access this copied line in VIM. So I can go here and I can say quotation mark plus to access that particular register and P to paste it in. And now you see that it has successfully pasted the content from the browser to VIM. So that's exactly what we want to do. So this is how you do it. But I will say quotation mark plus you gotta hold down shift. That's a little too much. Too many key presses we want to be nice and simple. So what I do in my machine is I actually read in my VMRC I make bindings for these and they're pretty much how you'd expect. Because most programs, they're going to use control V or control C. I actually have control P here for paste but that's for another reason. But so you can just take these two lines, put them in your VMRC and whenever you run control C it will yank the text. And whenever you run control P, it'll paste the text. Or you can do what is it? Control V is the actual, I use VIM bindings on everything. Sometimes I forget what the normal ones are but I think it's control V is the more typical one. But you can just put these lines in and save yourself a couple finger movements in actually pressing these keys or whatever. Now I should say two final notes on this. First off, as I said, just throw these in your VMRC and they'll work. But you might want to consider, instead of using lowercase p, using capital P. If you don't know the difference between these, well, let me just show you an example. Let's say I yank this word, Veno remap. And I go to the beginning of this line and I press lowercase p. And it actually is going to paste that stuff after the first letter. And that might annoy you, if you want it to be pasted beforehand, you want to have capital P. So you might want to contemplate having capital P as your default paste thing here. And I will say for Linux users, there are actually two different copying buffer or registers, whatever you want to call them. And that is there's the plus, which is sort of your default system clipboard. And there's also primary selection, which is something a little different in Linux. And I will say that the line I actually have in my VMRC is this one. Where I copy whatever is highlighted to primary selection, which instead of plus, you use the asterisk, the star. And then I let the actual thing I've pasted be equal to that. It doesn't matter. But the reason I do this is because there are some programs in Linux that use primary selection instead of the system clipboard by default. I think my terminal works like that. So this is a more robust solution if you're a Linux user, because it'll work on more things just because Linux has these two different options. But that's about it. So again, it's relatively simple. If you want to be able to copy and paste from VIM to something else, just install GVIM and use the plus buffer or plus register. I keep wanting to call them buffers. I don't know why. So you just copy or paste from the plus. Now I'm losing track of all my words. Copy and paste to the plus register. And throw these lines in your VMRC if you want it even quicker. And that's about it. So see you guys next time. I hope that cleared some things up for you guys. I know people have asked about this. But yep, it's as simple as that. See you next time.