Vim Help System
The course is part of this learning path
This brief course shows you around the Vim Help System with a view to helping you become self-sufficient when learning Vim, and so that you know where to go when you need help. We will also walk you through a guided demo to give you some practice and experience using the built-in Vim help system.
This course is ideal for anyone who uses Vim and wants to understand how to use the help system.
If you want to follow along with the exercises in this course, you should have the Vim text editor installed on your computer.
If you want to follow along with the exercise(s) in this course, you can find the necessary resources here.
The goal of this practice exercise is to get some practice and experience using the built-in Vim help system. First thing you wanna do is start a command line session on your local machine and then next you wanna navigate to your VIM class folder and finally open help.txts For me on my system, I downloaded it to my downloads folder, extracted the contents of the course download here which created the Vim class folder. Finally, there's a help.txt file in here that we're going to use for this exercise. So we'll open it up, VIM help.txt. We're just going to start the help system by typing :help and pressing Enter. I encourage you to read the text on your screen. You can use J to navigate down or Control + F page down, W to move by a word. This is just a normal text file that you can navigate as you would any other file. So just read a little bit about the help system here and then we'll quit the help system by typing :Q and pressing Enter. Now, just to get back in the help system we can type :H which is the shortcut form of the command help. And then we'll just do :H and press Enter and we're back into the help system. The next part of the exercise is just reading the help on some of the commands you already know. Let's go through some of these real quick. We'll use help on the I command which inserts the text before the cursor. And it puts you into insert mode. I'll use Control + F to see if there's more information about lowercase I and it doesn't appear there is. The next command we can look at will be wq. So we'll do a :h wq press Enter and here we're looking at the documentation of wq which means write the current file and quit. Likewise we'll do :h :q to look at the Q command. As you already know the ;q command is short for :quit and it quits the current window. So here we have two windows open, the help window on top. And if we were to run :q and hit Enter it would close the help window leaving us with only one window open and then we can close that one as well by typing :q and hitting Enter again. Let's look at some documentation about Control + F, :h just type out Control C-T-R-L dash F. Here it says, Control + F scrolls the window, count pages forward or downwards and the buffer, by the way with VIM you can think of a buffer as being a file. Now you don't have to type out Control like we did here. You can use a shortcut, so if we do :h Space the caret symbol which is Shift + six on my keyboard and then F then that is short for Control + F as well. If we hit Enter, we don't really go anywhere 'cause we were already there in the help system but we can do this with Control + B as well. Let's practice that :h Space Control + B or caret B, hit Enter and it says, Control + B scroll the window, count pages backwards or upwards. The last command on the list here is the W command. So let's look at the help for it. We'll do :h w and press Enter. You can see that it brings us to the word motion help section and the W command moves, count words forward again with count being in brackets meaning that it's optional. Now let's look up the documentation for the W command actually it's right below but if we just want to get some practice we can go :h shift + W hit Enter and now we're looking at the W command. So let's practice another way of jumping around through the help system. I'm gonna press the J key and then I'll do B to move backward, B to move back another word and finally B to move back a third word. And now what I can do is type Control and close bracket to jump to the documentation for what's under my cursor, which is exclusive here. So Control close bracket and we are placed at that particular place in the documentation it jumps right there. Now, if we wanna get back to where we just were, we can use Control + O and it jumps back to the documentation for the shift + W or W command. Let's get some information on count and I'll just move down here a couple of lines and put my cursor around count here and then do Control close bracket. And it jumps to the documentation on count, right? You can take a minute here to read about how count is used in VIM and then when you're done you can jump back to where you were with Control + O. Let's say you wanted to determine if there were any other ways of performing the Control + G command. So we've seen in the past where we can type :q which is actually short for :quit. And we've also seen things like D which is the same thing as running D$. So there are multiple ways to do the same thing in VIM. So let's get some information about Control + G and let's see if there are other ways to issue the same command but just in a different way. So we can use :h and then the caret symbol for Control and G and press Enter. Okay it looks like there is another way you can run this command. You can actually use :f to get information about the file, which you see happen there at the bottom of your screen. You can actually do :file and press Enter. So Control + G is the same as :f and of course the ILEN file RN bracket. So that means there are optional. Let's switch back to the file were editing and we'll do that with Control + WW. Let's say you wanna make sure that you're editing this particular file and you can do that by pressing Control + G. And it says help.txt, which is the file that we opened when we started the practice exercise. Okay, switch back to the help window by doing Control + WW. And if you want to explore some more just look around in the help system, you can look at other commands we've touched on in the class or just explore on your own. Whenever you're done, you just type :q to close out the help window and finally :q to close out the help file that we initially opened at the beginning of this lesson.
Jason is the founder of the Linux Training Academy as well as the author of "Linux for Beginners" and "Command Line Kung Fu." He has over 20 years of professional Linux experience, having worked for industry leaders such as Hewlett-Packard, Xerox, UPS, FireEye, and Amazon.com. Nothing gives him more satisfaction than knowing he has helped thousands of IT professionals level up their careers through his many books and courses.