VIM is an advanced text editor which can be used in a console as well as in a graphical environment. Once you learn the commands and tricks, it makes working with text lightening fast, easy, and fun. The problem I find is that complete beginners can initially feel a great deal of frustration. There are different modes and commands which must be learned to do even the simplest of tasks. This guide offers a quick way to get that minimum knowledge.
VIM does not make use of the mouse. Everything is controlled through the keyboard.
VIM has different modes. Keys have different functions depending on the mode you are in. You can view which mode you are in by looking at the bottom of the screen.
VIM starts off in COMMAND mode.
Learn enough to be comfortable. When you get comfortable, push yourself to learn new commands and tricks.
To change to COMMAND mode from VISUAL or INSERT modes just hit the esc or escape key. To change to VISUAL mode from COMMAND mode press the v key on the keyboard. To change to INSERT mode from COMMAND mode press the i or a key on the keyboard.
Saving and Quitting can only be done in COMMAND mode.
A command is run after you press the enter key on the keyboard.
To exit VIM you must type the command :q (quit)
To save you must type the command :w (write)
To quit and save you can use the :wq command (use the :wq! command to force the write quit)
To edit the file you must be in INSERT mode. Now you can enter text like you normally would in Notepad or Microsoft Word.
The h key moves the cursor left one character/space.
The l key moves the cursor right one character/space.
The j key moves the cursor down one line.
The k key moves the cursor up one line.
Type /knowl and press enter to search for the string knowl in the file (pressing the n key after searching for /knowl brings you to the next place the letters knowl are found in the file)
The w key moves the cursor to the next word on the right.
The 45G command moves the cursor to the start of line 45.
The $ command moves the cursor to the rightmost part of the current line.
The 0 command moves the cursor to the leftmost part of the current line.
The ]] command moves you to the bottom of the file.
The [[ command moves you to the top of the file.
The dd command deletes the line the cursor is on.
The dw command deletes the word the cursor is on.
The dG command deletes the line you are on and all the lines below it.
The u command is undo. This command is important and can help you go back if you made a mistake.
The :help command brings you to the VIM help file and is the place to go when you have questions.
VIM Video Tutorials by Derek Wyatt