This course covers modes in Vim and looks at the command-line version of Vim. We then guide you through a demonstration of how to create and edit files in Vim, in order to provide with a practical understanding of the concepts and to give you the chance to try them out for yourself.
- Get a basic understanding of modes as well as the command-line version of Vim
- Learn how to create and edit files in Vim
This course is ideal for anyone who needs to edit files in a command-line environment.
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.
One of the things that makes Vim different from most other editors is that it has the concept of modes. For now, I just want to give you a quick overview of the modes. We'll be exploring each mode in depth in other lessons in the course. However, being aware that there are different modes and knowing what those modes are will really help you understand and learn Vim more quickly. When you start most editors, anything you type goes into the file or document that you're editing. That's not so with Vim. When you start Vim, you're actually placed into what is called normal mode. Some people refer to normal mode as command mode because anything you type at this point is interpreted as a command. By the way, it'll probably come as no surprise to you that Vim commands are case-sensitive, just as Linux and Unix commands are case sensitive. In order to send what you're typing into the document, you have to enter insert mode. There are a few ways to enter insert mode that you'll learn about later in the course, but the simplest way to enter insert mode is to press lowercase i. In insert mode, your keystrokes are not interpreted as commands. Instead, they are considered content for the file that you're editing. To leave insert mode and return to normal mode, press Escape. The last mode you should be aware of for now is line mode. Sometimes line mode is referred to as last line mode or even command line mode. To enter line mode from normal mode, type a colon. At this point, your cursor goes to the bottom line of your screen where you can type in a command and press Enter. You'll use line mode to perform various actions, such as saving a file, going to a specific location in the file, and turning on and off various Vim options and features. There are two ways to leave command mode. The first is after you've typed the command, you'll press Enter to execute that command. Once the command is completed, you're returned to normal mode. If you want to abandon the command, press Escape to return to normal mode. To review, there are three main modes in Vim. They are normal mode, sometimes called command mode, insert mode, and line mode. Keep in mind that you can always get to normal mode by pressing the Escape key. There are other modes in Vim, but they are really just slight variations on these three main modes. And don't worry, we'll be covering those other modes in the course as well. However, knowing about these three main modes will make learning Vim a lot easier going forward.
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.