 The best place to learn Vim is of course VimTutor. When you download Vim and just type VimTutor in a terminal this little guide will come up and you should go through that if you want to learn all the basics and Vim is a very powerful text editor that I think most people who use Linux end up using if they don't go on to Emacs later But once you go through this teaches you a whole lot of the basics But there's some things that are very useful that they for the sake of time. They don't go over So in this video, I want to cover sort of You know all the best things about Vim that you don't learn in the VimTutor at least five or six nice little tips So as an example here is here is a real-life document. This is actually my thesis And let me show you some things that you know, let me show you some things you might not know So of course you learn that they basic movement in Vim of course involves H, J, K, and L So J and K are up and down H and L are left and right Now one of the things that might be a little unintuitive to you is that let's say you have a big paragraph like this Now if I'm up here, I press K to go up J to go down You might think if you press J again, you'll go to this R But you actually go to the next line because this whole thing this whole block here That's just one logical line and Vim moves on logical lines But let's say you want to move down just to this visual line What you what you can do is press G J Or you know to go up you can press G K If you press G K or G J You can move on these visual lines sort of in the way you would like in something like Microsoft Word So this might be more intuitive to you It might be important certain situations and that's one thing that you know You don't actually hear that much, but it is out there So that's one little thing another thing one thing that people who start using Vim often complain about Is that Vim doesn't necessarily have a spell checker? It's effort absolutely does have a spell checker if you open up your Vim RC Let me just in case you don't know how to open up a Vim RC. You just type in a terminal Vim And then open up Dot Vim RC in your home directory And here's my Vim RC yours might be empty if you've never changed it But if you add this little line into Your Vim RC this will map the spell checking command to f6 and that's what I have in my configurations So what that does is whenever you press f6? All of the misspelled words or at least words that aren't in the dictionary will be highlighted Now most of these actually all are correctly spelled They're just not in the dictionary, but if I type something like I like You know buttered toast You'll see that the misspelled words are highlighted in red so I can go in and change these if I So need to so that is a nice tool people don't a lot of people don't know that that's there But that is a built-in feature of Vim It's just sort of hidden away like all the features of them They're all they're all a little hidden Vim has all these crazy things that people don't know about but they're You know you got you got to look them out. So that's another thing now a Another little optimization which I actually didn't learn about till recently. I'm a little You know disappointed with myself But in the Vim Tutor you learn that you can use the delete and change keys With like different objects one of them is if you press D and then dollar sign That means delete to the end of the line So if we're here in the word to impress D dollar sign it deletes everything after that to the end of the line Same thing with C dollar sign that deletes and puts you in insert mode So those are very important shortcuts you use them all the time But the thing is that's a little hard to press it involves pressing two keys one of which is like shift and then four That's just a pain So what you can actually do instead is you can actually just press capital D and it does the same thing I don't know why they don't tell you that Or capital C does the same thing and you can just type whatever you want That is I don't I didn't know that till very recently. I feel sort of stupid for that And there are also one of the things I like doing when I'm bored and Vim is just randomly pressing buttons and seeing what happens You know some other ones for example, there's capital J So if you're on a line jet capital J means join this line you're on with the line below it So if I I'm in this line right here if I press capital J The line below it has been merged with it. Of course it was empty, but if I press J again Now we have these two paragraphs that are all in one paragraph So that that's a nice key as well Now the big thing about Vim that they don't actually mention in VimTutor is sort of Inner and outer objects now what that means is You learn in Vim in VimTutor for example, let's say I'm right here I want to replace this word and what you do to do that is say see for change and W for word And then you can type whatever you want escape when you're done and that's it But if you're let's say I'm in the middle of this word and I press CW It only deletes the stuff afterwards and you might want to do that in some situation But if you want to change the entire word what you can do is use inner or outer depending on the earth inner or around So if you press C oops if you press C I W that means change inner word that means wherever I am in the word change the entire thing So that will act on the until it will delete the whole thing and then you know go on and change it Or if you press Or you can do the same with D. So like D I W means delete inner word You can also do the same so I is inner a is around so D AW means delete around the word that means delete the word and the white space around it that we don't need anymore Now you don't only have to do that with word words. You can say like D AS that means delete around a sentence. So I just deleted an entire sentence with that So DAS do it again undo those or D DAP for delete around a paragraph. I've now deleted an entire paragraph So now we can just make all these kind of modifications Just by feeding in arguments and the inner and outer arguments sort of make this You know really effective Now the last thing is You know one thing that goes with that that makes it really powerful is the dot command Or the the period command. So whenever you press period in Vim the period means do the exact command that I just told you to do over again Let's say for example Let me see how many times I so I have the word possession a whole lot. Let's say I don't like the word possession I want to replace it with something Now if I let's say I replace this word possession, let me get rid of the spell checker I don't know why that's still on if I say replace possession see IW with you know buttercup That's nice. Now I can let me actually search for another instance of it Let's say I want to replace that with buttercup as well Well, I could press CIW and then type it out again or I can just press period and period just Redo's the last command I did You know here it is again, you know period period blah blah blah blah blah blah blah So period is one of the most powerful commands in all of them Because no matter what you're doing. It's just repeating what you just did So for example, let me think of another example. Let's say you have a bunch of lines I mean, let's say you're doing something Well, this is a lot tech so we'll make some made-up lot tech example Let's say you want to add like something lines to the ends end of each line or like physical like actual Horizontal lines and you do that in lot tech by the h line command So each line so I did that by whole pressing capital a as you can see and then typing out h line So now if I press exit or you know move go back to normal mode If I press period again, it'll actually recreate the command I just did or period again there it goes again So this is a very nice way of just repeating commands You don't have to really worry about what actually is going on And you know if you get your text objects, right? You can make an enormous amount of modifications just by doing periods So anyway, that's probably about enough. I threw a couple things out at you You might want to practice on I might have some other videos because there's so much just little stuff about them They don't necessarily need Videos for or themselves, but you know, maybe I'll have some other videos on this kind of stuff as well So hope you enjoyed hope you learned something and have some fun with them