[ Previous chapter ][ This chapter ][ Next chapter ]
NOTE: The following is a very basic "cookbook" introduction. You should read a manual or ask colleagues if you intend to work more closely with the 'vi' editor. Other, possibly more user-friendly, editors (e.g., 'emacs') are not described here.
To edit a file with the 'vi' editor, type
% vi file.dat
If you see an error message (e.g., "Unknown terminal type"), press <q> to exit. Then set the terminal to "vt100" as described in section "Unknown Terminal" before starting to edit again. If you see the symbol
:
press <RETURN> to get in full-screen editing mode.
You first have to press the key <i> to get into insert mode. Then, all you type will appear on the screen and in the file after saving it. To escape from insert mode, hit the <ESC> key. If this does not work (beeping), try <CTRL><3> instead. The cursor keys can be used for navigation if you are not in insert mode. The key <x> should delete the previous character and move the cursor to this position if you are not in insert mode, while <DELETE> or <BACKSPACE> or <CTRL><H> do the same in insert mode.
To get help on the 'vi' editor, you must be on the % prompt to request the manual page with the command
% man vi
If the screen is corrupted
by operator messages or behaves strangely, try <CTRL><L>.
On terminal emulators,
other keystrokes might be needed (refer to your manual for details).
When you have finished editing, use <ESC><:> to get the symbol
:
There, type the command 'wq' (for write and quit). The file will be saved, and you
should
be back at the
%
prompt.
Subsection 5.3.5 Exit the Editor
[ previous chapter ],[
this chapter ][ next chapter ]
, [next page/section] , or [overview] , or [table of contents]