Editors


Editors

You can find the following text editors on the companion CD-ROMs:

  • GNU Emacs, which is the one and only original Emacs

  • Vim, which is a vi-like editor

  • GUI text editors that are part of GNOME and KDE

As you can see, most of these editors aspire to be either GNU Emacs or vi. The look-alikes typically are smaller and have fewer features.

The GUI text editors are part of GNOME and KDE.

GNU Emacs

The companion CD-ROM includes GNU Emacs version 21.2. GNU Emacs, one of the best-known GNU products, is distributed by the Free Software Foundation. The GNU Emacs binary is /usr/bin/emacs, which works under X and provides menus for editing operations. You must have X installed to run Emacs.

Cross Ref 

Chapter 11 describes the features of GNU Emacs and how to use it for text-editing tasks.

Vim

Vim stands for Vi IMproved. As the name implies, Vim is an improved version of the standard UNIX text editor vi. The companion CD-ROMs include version 6.1 of Vim. In addition to the standard vi commands, Vim includes many new features, including several levels of undo, command-line history, and filename completion.

Cross Ref 

In Red Hat Linux, when you run the vi editor, you are running Vim. Chapter 11 shows you how to use the vi editor.

GUI Text Editors

Both of the Linux graphical desktops—GNOME and KDE—come with GUI text editors (text editors that have graphical user interfaces).

To try the GNOME text editor, gedit, select Main Menu>Accessoriess>Text Editor from the GNOME desktop. You can open a file by clicking the Open button on the toolbar. This brings up the Open File dialog box. You can then change directories and select the file to edit by clicking the OK button.

The gedit editor then loads the file in its window. You can open more than one file and move among them as you edit the files. Figure 10-1 shows a typical editing session with gedit.

Click To expand
Figure 10-1: Editing Several Files with gedit.

In this case, the editor has four files open for editing: fstab, inittab, hosts, and modules.conf (all from the /etc directory). The filenames appear as tabs below the toolbar of the editor’s window. You can switch among the files by clicking the tabs with the filenames.

The rest of the text-editing steps are intuitive. To enter new text, click to position the cursor and begin typing. You can select text and copy or cut it by using the buttons on the toolbar above the text-editing area. To paste the text elsewhere in the file, position the cursor, and click the Paste button.

From the KDE desktop, you can start the KDE text editor by selecting Main Menu>Accessories>Kate. To open a text file, select File>Open from the menu. A dialog box appears. From this dialog box, you can go to the desired directory, select the file to open, and click the OK button. The KDE text editor then opens the file and displays its contents in the window. You can then edit the file.