Run interactive vim tutorials as many times as needed to feel comfortable with the basics.
Vim features several modes, e.g. normal mode, insert mode and command-line mode.
Normal mode is for editing and navigating text. In this mode
l correspond to the cursor keys
→. Most commands in normal mode can be prefixed with a "count", e.g.
3j moves down 3 lines.
Insert mode is for inserting the text directly, in this mode vim is similar to other more simple text editors. To enter insert mode press
i in normal mode. To leave it press
<ESC> (escape key).
Command-line mode is for running more complex commands like saving the file and exiting vim. Press
: to start the command-line mode. To leave this mode you can also press
<ESC>. To save the changes to the file use
:write). To exit vim without saving your changes use
These are some of the more useful commands in vim:
|(insert) enters insert mode before the current cursor position|
|enters insert mode before the first printable character of the current line|
|(append) enters insert mode after the current cursor position|
|enters insert mode after the last printable character of the current line|
|delete character at the current cursor position|
|delete character at the left to the current cursor position|
|move to next word|
|move to previous word|
|move to the beginning of line|
|move to the end of line|
|replace – enters replace mode for one character. The next character you type will replace the character under the cursor.|
|enters replace mode indefinitely. Every character you type will replace the character under the cursor and advance the cursor by one.|
|substitute – deletes the character at the current cursor position and then enters insert mode|
|delete the current line that the cursor is currently on and enter insert mode|
|exit insert mode and returns to normal mode|
|cut the current line, from the cursor to next word, or the character, current position to end of current line respectively, note: |
|change the current line, from the cursor to next word, or the character, respectively|
|yank ("copy") the current line, from the cursor to next word, or the character, current position to end of current line respectively|
|put ("paste") after, or before current position, respectively|
|to create a new empty line, after or before the current one and enter insert mode|
|write the current buffer to disk|
|quit without writing|
|write and quit|
|open a window with help file|
|show help for a specific subject|
|begin recording actions to register |