Text editors fall somewhere between word processors like OpenOffice.org Writer and pager applications like less. These programs are useful for tasks like writing HTML, C, or SGML; they are best suited for any task that is text-oriented, and is not necessarily intended for print.
Programs that allow you to view PDF and PS files are referred to as text viewers. They do not allow a user to edit the text directly, but do allow the user to view the pre-formatted text.
Red Hat Enterprise Linux comes with several applications that can be used to write and edit program code. These programs are text editors, programs that provide the user with helpful highlighting and formatting options without making changes or additions to the text. The most common of these text editors are vi and Emacs. Two additional useful editors are gedit and kate.
vi is a shell prompt text editor. This means that like less, opening an instance of vi does not open a GUI window. Instead, the contents of the file being edited appear in the current terminal window. Because vi works without a GUI, it can be used to edit text files even when X is not working.
vi operates via keystrokes — listed below is a small set of the keystrokes necessary to work with text in vi.
Key | Action |
---|---|
With a file open, press | |
Pressing the | |
| |
Table 9-1. Useful keys in vi
vi uses many more keystrokes. To learn more about vi, view the manual page by entering man vi at a shell prompt. You can also access the vim tutorial but entering vimtutor command at a shell prompt.
Emacs is a text editor that includes a GUI component. Like vi, Emacs also makes use of keyboard shortcuts to manipulate text. Users can choose between working with the mouse or the keyboard; all commands are available via either method.
Emacs can be customized extensively. Programs that customize syntax highlighting or add other functionality can be written and installed. Emacs even contains several games available from the Tools => Games menu, and a "psychiatrist" availabel from the Help menu.
An Emacs tutorial is available by selecting Help => Emacs Tutorial from the main toolbar.