How Do I Get Out of VI?
If you have mistakenly found youself stuck in a VI editor and are not masochistic
enough to have mastered it's use, don't panic. You can escape.
- First, just in case you've accidentally entered an editing mode unwittingly simply
hit the <ESC> key.
- Next, type:
- :q
This will get you out without saving any changes.
The following is an exerpt taken from the University of Hawaii's College of Engineering web site.
For an excellent tutorial or reference please go to their web site for more information on
Mastering the VI editor.
-
Some Simple VI Commands
Here is a simple set of commands to get a beginning VI user started. There are
many other convenient commands, which will be discussed in later sections.
- a
- enter insert mode, the characters typed in will be inserted
after the current cursor position. If you specify a count, all the text
that had been inserted will be repeated that many times.
- h
- move the cursor to the left one character position.
- i
- enter insert mode, the characters typed in will be inserted
before the current cursor position. If you specify a count, all the text
that had been inserted will be repeated that many times.
- j
- move the cursor down one line.
- k
- move the cursor up one line.
- l
- move the cursor to the right one character position.
- r
- replace one character under the cursor. Specify count to
replace a number of characters
- u
- undo the last change to the file. Typing u again will re-do
the change.
- x
- delete character under the cursor. Count specifies how many
characters to delete. The characters will be deleted after the cursor.