 Okay, so time for another Vim video. So one thing that comes out a lot from people who don't use Vim or just getting into it, they hear all these scary things about it. And one thing about Vim that is sort of not a bug but a feature is that it does not use the mouse, not for anything. You don't select things with the mouse. You don't, you never have to move around to it or anything like that. It's just not a part of Vim. Everything you do, you do with your keys right on the home row. So you don't want to move around when you're using Vim. So that causes a lot of confusion for people because they, there are some things that people are just so used to doing with the mouse. So it's like how do you even do this kind of stuff in Vim? So just before we even start talking about Vim, think about the mouse. The mouse is, I don't know, the mouse is a problem when you think about it. At least it's an ergonomic problem in that a lot of times you are doing your thing, you're writing something, you have your keys on the keyboard and there's some basic function that you need to use the mouse for. Like most programs are built to use the mouse. And when you do that, you of course have to, you take your right hand or your left handed, if you're left handed, you leave the keyboard, you go all the way, oh God, it's so far, all the way to where your mouse is. You pick up your mouse, you move it around, you use a totally different modality, you know, you graphically, physically move your mouse, then you go all the way back to your keyboard and keep typing. Now that might sound like something so trivial, but to a lot of people, including myself, before I started using Vim, that really annoyed me. I like to have everything, not just on the keyboard, but like everything right sort of, even I don't like moving up to page up and page down. I want to be able to do everything pretty much at the home row, and that is the thought behind a lot of Vim's design. Now, so there are two things. I'm going to open up a document where we can all actually talk about Vim. So there are two things really that people use the mouse for nowadays. One of those is just moving around. So I have my cursor right here. Let's say I want to move down to this word. Let's say I spelt it wrong or something like that. People are used to taking your mouse and just clicking right here to move down to it. Now Vim is not paying attention to your mouse, so I can click as much as I want on this line. It's not going to do anything. So that's one thing people are used to using the cursor or the mouse for that is moving to a different place. The other thing is highlighting stuff. So people are used to being able to highlight things and copy them with the mouse. Now you see that things are being highlighted, but this is because of my terminal emulator, not because of Vim. Vim is not paying attention to any of this. It doesn't care that I am highlighting this. It's not going to move up or down or something like that. None of that matters for Vim. So how do you do those two things? Selecting stuff and moving around efficiently. So I am actually going to... Let's move down a little bit. I am going to turn on screen keys so you can see what keys I'm pressing. Now we'll talk about selecting stuff first. So if you've taken VimTutor, which you should have done, just go into your terminal and type in VimTutor and do that. Now if you've done VimTutor, you at least know about visual mode. And visual mode, let's say you're on this word, you can press V, and you can move around and you will be highlighting that stuff. And I can do something like D for delete or I can do Y for yank or something like that. Now visual mode also can pay attention to... Let's say I want to select this up into the end of this word list. I can use other text objects like E for end of word or something like that. Or I can use FT for find the next T or something like that. So you can use visual mode with those typical commands. Or let's say, for example, I am on this big paragraph here, this list of characters. And I want to basically copy the whole thing. Now the newbie way to do that would be go, you know, press V and highlight the whole thing, which would be a huge waste of effort. But the real way to do it is VAP, which that would mean visual mode over all of the paragraph. So now we have that whole thing. And you can do that from anywhere in it, VAP. I can do it at the end, VAP, something like that. And you can copy that or do some kind of operation on it with visual mode. Same thing if I am, let's say up here, with this, excuse me, this parenthesis, I can say V in parentheses. And I will use, you know, I'll highlight everything in those parentheses. Or it looks like there's some brackets in here. So V in brackets or V a brackets for, you know, highlighting this everything, including the brackets. So that's that's the basic stuff of it. But there are also other visual modes. So this is the one using just V where you manually move it around. Other things that you might want to use because, you know, a lot of times they make more sense is if you want to select lines, you can do capital V. And that's not going to pay attention to where your cursor is in the line. It's just going to copy the entire thing. So if I'm up here, just, you know, to be clear of the difference, if I just use V here, it's not, you know, capturing A and all that stuff. But if I use capital V, it will. And the other visual mode that's worth talking about is control V. So if I use control V, it's actually not very clear here. Let's say I'm on one and I use control V. I can actually, you know, select a block of text here. So I've select this block and I actually can do different modifications. There's let's say I choose see for change. I can add some stuff in here. And that will actually add it in all of the places the block was in. So I can do actually similar to what I did in the last video. But, you know, instead of using norm, I can use visual block and I can say, you know, capital I to go to the beginning of that and add some text or something like that. So that's the general idea of how you actually select things. That is you don't, you know, let's compare it to your mouse. Now, what your mouse does is, you know, you go in here. Sometimes you miss a character because you're just sort of, you know, eyeballing it or something like that. But VIM has a very precise way of highlighting things. You just tell it what text object to highlight and it works. So, you know, VAP, take this entire paragraph, delete it, you know, move down a couple paragraphs, puke it in there and that works perfectly. So I should say in most of these situations when we're selecting these, the proper VIM way to do it that saves the most key presses, you wouldn't even use visual mode. So instead of saying VAP and then D to delete it, you would actually say DAP to delete the entire paragraph, go where you want and you can paste it in. So in most situations when you're talking about just simple text objects, like, for example, you know, the stuff in the parentheses here, you wouldn't say, you know, V in parentheses then change. You would really just say change in parentheses. So most of the times you're highlighting something with your mouse, you don't even need the highlighting in VIM, even though you can get that. You can skip a step and just change it or move it or something like that. So this is one of the reasons that using the different kinds of visual modes in VIM is so nice. Now, the other thing we talked about is moving around to different places. So let's say I want to go all the way down here to line 13 or well, the thing that says line 13, it's, you know, line 23 from where I am right now. So how do you how should you actually move around efficiently in VIM? Now, again, if you were just using, you know, what you learned in VIM Tudor and, you know, the intuitive stuff, you'll just be using HJKL, which is a huge. It's very nice that you're not moving from the home row, but it is a huge waste of time to press these keys a million times and move to the places you want. Now, the first thing that people should really get in the habit of using is simply the search function. So if I want to go down to this thing that says line 13, you should just press slash and then line 13 and you'll go straight down to it unless there's some other place you have it written beforehand. Or if you want to search backwards, use question mark. Let's say I want to go to this word formulation. So form, elation or something like that, I just type in form and you get to it. So you should get in the habit of just using the search function for direct movement. But of course, there are better ways of moving around in VIM anyway. If I want to move to the top of the screen, for example, wherever my screen may be, I can just press capital H. That means high or something like that. Capital M means middle. Capital L means low. So I can move to these parts of the screen. And of course, they're not set. If I go down half a screen, now middle is here, now low is here. It's always in the same position of your actual VIM buffer. So these are, you know, other movement keys you can use. Additionally, you can move up and down by paragraphs by using brackets. So left bracket will move up a paragraph, right bracket will move down a paragraph. So this is, you know, similar if I want to delete this paragraph, like we did before, DAP, I can move down by paragraphs and just paste it in wherever I want. So that's very convenient. So this is a quicker way to move. And of course, when you're on a line, in addition to using, let's say I want to, you know, find, I don't know, I want to go to, I don't know, let's say I want to go to this R, this remember. Other things you can do is just use the, you can either use W for moving words. That, of course, requires multiple key presses. You always want to memorize or, excuse me, minimize those. You may also want to try F R and that will move to the next R. And then it, excuse me, I'm left that line. So F R and then F R again is going to take us to the next R and then the next R, et cetera. You can actually use semi colon to repeat the command. And this, of course, capital F does the reverse thing. So capital F R goes to the last R. So that's movement on a line. And of course, there are different ways. A lot of you can probably check the comment section and people will tell you a million other ways to do different things. But this is so this video has just been an explanation of why you don't really use the mouse and Vim, why you don't need it. And there are a bunch of different commands that you can use to reproduce what you do with the mouse. And at the beginning, sometimes they are a little daunting, like, oh, I have to memorize all these key presses to do the stuff. But all of them sort of work together logically. You can and they combine with each other. And of course, once you get them in your muscle memory, you will never be like, oh, jeez, I wish I could use my mouse here because that's sort of, you know, it really hits you how much of a waste of time it is. So anyway, this has been pretty much it. If you have any additions, throw them in the comments and I will see you guys next time.