Red Hat Enterprise Linux 4: Red Hat Enterprise Linux Step By Step Guide
Prev |  | Next

# Chapter 9. Working with Other Text Applications

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.

# 9.1. Working with Text Editors

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.

## 9.1.1. vi

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
--- | ---
<KEYCAP >[i]</KEYCAP > | With a file open, press <KEYCAP >[i]</KEYCAP > to enter Insert mode. This mode allows you to move the cursor and to delete and add text anywhere in the file.
<KEYCAP >[Esc]</KEYCAP > | Pressing the <KEYCAP >[Esc]</KEYCAP > key at any time takes you out of Insert mode and into Normal mode.
<KEYCAP >[w]</KEYCAP > | <KEYCAP >[w]</KEYCAP > writes your changes to the file. Enter Normal mode, press <KEYCAP >[Shift]</KEYCAP >-<KEYCAP >[:]</KEYCAP >, <KEYCAP >[w]</KEYCAP >, and finally press <KEYCAP >[Enter]</KEYCAP >.
<KEYCAP >[q]</KEYCAP > | <KEYCAP >[q]</KEYCAP > quits vi. Enter Normal mode, press <KEYCAP >[Shift]</KEYCAP >-<KEYCAP >[:]</KEYCAP >, <KEYCAP >[q]</KEYCAP >, and finally press <KEYCAP >[Enter]</KEYCAP >. To save your changes before exiting, enter `:wq`. To quit without saving your changes, enter `:q!`.
<KEYCAP >[!]</KEYCAP > | <KEYCAP >[!]</KEYCAP > forces vi to execute the commands that precede it.

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.

## 9.1.2. Emacs

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.

## 9.1.3. gedit

gedit is the GNOME text editor. It has highlight modes for HTML, Perl, C, PHP, and many other languages. gedit features print preview, the ability to undo your changes, and tabbed editing. gedit is fully integrated with Nautilus.

## 9.1.4. kate

kate is the KDE text editor. It also has highlight modes for multiple programming languages. kate uses split screens to display multiple files. kate also has the ability to open a terminal window within the application. kate is fully integrated wtih Konqueror.

Prev | Home | Next
OpenOffice.org Draw and Math | Up | Viewing PDF and PS files