This chapter is based on Chapters 9 through 12 of the Siever book, Linux in a Nutshell [Siever 2003] .
Linux has a surprisingly large number of available editors, many of them inherited from UNIX. Figure 1 illustrates some of them.
| Editor | Description |
|---|---|
ed | Original UNIX line-based editor, useful in scripts |
emacs | GNU editor and fully integrated user environment |
ex |
Powerful line-based editor (integrated with vi)
|
gawk | GNU awk, powerful text editor for records containing fields |
sed | Stream-oriented (non-interactive) line-based editor |
vi | Classic screen-based editor for UNIX |
vim | Vi IMproved, enhanced support for programmers |
Some distributions have vim as the default
version of vi, e.g. Red Hat Linux. This brief
overview will concentrate on the two important screen-based
editors that are shipped with Linux distributions. For
information on the other editors, consult the relevant
man pages.
Emacs is more than "just an editor" -- it provides a fully integrated user environment offering the sort of facilities outlined below.
Emacs has a vast number of editing modes, which create an environment designed for the type of editing you are doing. There are two types of modes, major and minor.
These allow you to set or unset features that are independent of the major mode, e.g. auto-fill (word wrapping), insert vs overwrite, and auto-save.
If you spend a lot of time editing files with a particular
structure, then a customised version of emacs
will pay real dividends by reducing the number of keystrokes
needed to complete a specific task. For more information,
see Learning GNU Emacs
[Cameron 1996]
.
This is the classic screen-based editor for UNIX. Apart
from vim, there are a number of enhanced
versions of vi, including elvis,
nvi, and vile. The
vi editor works in two modes,
command and
insert. This is attractive for users
who separate text entry from editing.
Once a file is opened, you are in command mode. This provides the following facilities.
ex commands
You enter new text in the file (e.g. append, insert,
overwrite, or substitute) and then press Esc to
return to command mode. For more information, see
Learning the vi Editor
[Lamb 1998]
.
| Last modified: Mon Dec 5 12:50:26 2005 |