- Before You Start
- Running Vim for the First Time
- Editing for the First Time
- Other Editing Commands
- Using a Count to Edit Faster
- The Vim Tutorial
Running Vim for the First Time
To start Vim, enter this command:
$ gvim file.txt
Note that the $ is the default UNIX command prompt. Your prompt might differ.
If you are running Microsoft Windows, open an MS-DOS prompt window and enter this command:
C:> gvim file.txt
(Again, your prompt may differ.)
In either case, Vim starts editing a file called file.txt. Because this is a new file, you get a blank window. Figure 1 shows what your screen will look like.
The tilde (~) lines indicate lines not in the file. In other words, when Vim runs out of file to display, it displays tilde lines. At the bottom of a screen, a message line indicates the file is named file.txt and shows that you are creating a new file. The message information is temporary and other information overwrites it when you type the first character.
Figure 1 Initial vim window.
The vim Command
The gvim command causes the editor to create a new window for editing. If you use the command vim, the editing occurs inside your command window. In other words, if you are running inside an xterm, the editor uses your xterm window. If you are using an MS-DOS command prompt window under Microsoft Windows, the editing occurs inside the window. Figure 2 shows a typical MS-DOS command prompt window.
Figure 2 Editing with the vim command in an MS-DOS window.
Modes
The Vim editor is a modal editor. That means that the editor behaves differently, depending on which mode you are in. If the bottom of the screen displays the filename or is blank, you are in normal mode. If you are in insert mode, the indicator displays --INSERT--; and if you are in visual mode, the indicator shows --VISUAL--.