 Alright, what's up, everyone? So in this video, we're going to be talking about VI mode in Bash, or Vim mode, however you want to think about it. So you may have never heard of Vim mode in Bash. In fact, I had never heard of it until two weeks ago, so if you haven't heard about it, you're not totally retarded. This is one of the less sung features of Bash, despite the fact that so many people could use it. Every once in a while you'll see this in someone's Bash RC, but it's honestly not that common. I've talked to a lot of people who are huge Vim users and they don't know about this. So I wanted to do a little video just sort of raising awareness, so you actually know that this thing is out there because it's incredibly good. So just to get, you know, again, VI mode, it is built into Bash. It's not a plug-in. It's not something you have to install. It's not another program that, you know, you have to download. It is literally built in. If you want to activate VI mode, it's super easy. Just open up your Bash RC. This is mine right here. And the line in question, you want to add this, just say set OVI. Literally just six letters and a hyphen if you want to be anal about it, but that's all you need. And once you do that, the next time you boot up or boot up, start up Bash, you will be in VI mode. So we are in VI mode right now. Okay, so at the basics, it basically feels exactly like a normal prompt. You could give this to anyone else. They wouldn't notice. So you can say, you know, this is a normal Bash prompt. All right, so types just as normal as anything else, just press enter to run commands exactly like how the normal prompt is. But you have basically normal mode shortcuts. So let me turn on screen key for you guys so you can see what I'm typing. But when I press escape, I'm now in normal mode. My cursor moves. And now I have all the basic VI shortcuts. So for example, H to go left, L to go right, B to go backward, W to move forward, all that kind of stuff. In fact, it's actually surprising. I mean, so you got your basic movement commands, all of those, zero to go to the beginning, dollar sign to go to the end. Also, if you want to go up or down in your command history, you don't have to use the up and down arrows. You can use K and J. So everything is right, you know, on the home row, so to speak. But all the normal Bash movement commands are in there. And of course, more advanced stuff is in there. So let's say I want to change a word. Of course, if you're moving around in your prompt, it's because you want to edit something you mistyped. So let's say I want to change this word. Well, just like in Vim, see for change, W for word. And just type in whatever word you want when you're done, press escape, just like in Vim. You also, let's see, so you also have like access to basically a buffer so you can copy and paste things. So I can yank this word up, YW yank word. And then I'll go to the end of the line and I can paste it a couple times, right? I can also undo that pasting with you. You even have undo as a command in here. Or you can, you know, iterate commands multiple times. So let's say 5p to paste something five times. There it is, five times. And of course, we can delete that. In fact, we can delete the whole line with DD, just like in Vim. Or if we want to delete something and get into insert mode, CC, just like in Vim. So this is another bash command. So you also have things that are maybe a little bit more advanced. So one of the best commands in Vim, of course, is period, which just means repeat the last command I did. So you can do something like let's do capital A to add something to the end. I'll throw in some word at the end. And now I can press period to repeat that command multiple times. It's just that easy. I can do the same thing, you know, at the beginning of the line or something like that and repeat that multiple times. Right, so this is pretty intuitively exactly like VI. Most of the basic commands are just like it. So there are some things you don't have in this. I mean, it has, it's impressive how much it has, but there's some things it doesn't have. One of them is, you know, let's say you have some text and you have things in quotation marks or you have things in parentheses or whatever. So in Vim, usually you can use these as text objects. So you can say change inside the parentheses. It doesn't work in, you know, the VI mode in bash. Same thing with, you know, quotation marks. You can't really do that. You can do it in actual Vim. You can't do it here. But aside from that, I mean, that's not something you're going to be using that much because you usually just have stuff on one line. But just, you know, it doesn't have everything. However, they do have things like search commands. So here I'm at the beginning of the line. I can press F, A, find A to go to the next A. I can press semicolon to, you know, continue that command. Finding the next A's. I can press comma to look backwards for A's behind me. All that kind of stuff. All these Vim commands that, even the ones that are relatively obscure, there's often an equivalent here. So if you want to see all of the bindings that are in this, you can use the bind command in bash and just run capital P. And if you run that, well, I'll go ahead and show you this. If you run that, it'll show you whatever operations are bound in the bash prompt right now. Now here are all the different commands in VI mode. Now you'll notice a lot of these are actually not bound to keys. Don't get confused by this. This is just because I ran it in insert mode where they weren't bound. So if you want to see the ones that are actually bound in actual Vim mode, just be sure to press escape first. Now you're in the normal mode. Run those and here they all are. So again, you got yank. You got replace mode. You got s, the functionality of that. You have the percent sign. You have, yeah, you pretty much have a lot of the basic stuff, even have tilde for capitalizing and stuff like that. So anyway, this is, so again, this is a VI mode in bash. I hope this is useful because I totally felt like I had wasted so many key presses in my life because I didn't know about this for months and months and months. But hopefully this has been useful. So anyway, I'll see you guys next time. Hope you learned something.