Thre are two basic types of text editors: GUI (Graphical User Interface)-based (text) editors and text-based (text) editors.
The GUI-based editors have all the convenience of a click and drag mouse based appliactions like roll down menus, buttons, click of a mouse cut, paste, font type and size change options, etc. in a multi window environment.
Figure 1, The GUI-based Gedit editor's interface
Text-based editors have none of these fancy point and click features. All cursor motion and formating is achieved by special combination of keystrokes that one has to memorize. While it is very easy and quick to master GUI-based editors the knowledge of how to use text-based editors often outweighs the somewhat painful process of learning it. Text-based editors have an advantage that they can be used on systems with minimal requirements. For example, it comes handy when one tries to access a computer remotely and have only a text-based shell access available. Or say, during a system maintenance when again only a shell prompt is available without any fancy graphical support. Often people who become quite experienced using text-based editors do their work much faster because it is much quicker to use keyboard keystrokes than to use menus and buttons with a mouse.
Well, after this long pitch let's look at some of the most popular text
editors in the above two categories that are available for Red Hat Linux.
To invoke these editors click on the appropriate menu item under Main Menu > Text Editors.
[The "main menu" is the "red hat" icon on your Red Hat Linux desktop.]
Or equivalently, to start them, type their name at the shell prompt.
Note that most of these editors come with a built in help menu, documentation, and/or tutorial which come quite handy while learning how to use them.
GUI-based text editors
The Gedit is the simplest one that comes with Red Hat Linux. It has an easy-to-figure-out interface, but it can be used only in a graphical desktop environment (i.e., it exists only in a GUI-based form).
There is also the new GUI-based version of the venerable text-based editor Vi called Vi IMproved.
And then there is Emacs (and XEmacs).
This program is more than just a text editor. It has a wide range of
useful special modes for programming (in C/C++, Fortran, Lisp, etc.) and for a
variety of other applications and utilities. For example one can use
automatic text indentation, run compilers, interpreters, and debuggers, and
issue commands to the shell all within the editor window itself. There are
built-in news and mail clients. One can access the Linux man and
info pages, play games, edit pictures, and generate web pages.
There are built-in commands for
version control system utilities which are used for large single or multiuser
projects (e.g., a dissertation or a computer program) to keep track of changes
in the evolving files.
Tutorials and documentation on these modes and many other special customization options are available under the Help menu item.
A long time ago, Emacs was for a text-only terminal environment, whereas XEmacs was a fork of Emacs designed for use in a graphical desktop environment. Since then, each codebase has picked up almost all the features of the other codebase. Consequently, from the user's perspective, the differences are mostly in the look and feel, and thus which you prefer is mostly a matter of taste. Emacs and XEmacs can each be used both as a GUI-based or as a text-based editor (see below).
Text-based text editors
The most common ones on Red Hat Linux are: pico, joe, Vi(vim), Nedit, and Emacs/XEmacs. Only few of these will be discussed below.
The easiest one to use is pico because it has a two line display at the bottom of the editor window which shows all the keystroke commands. By the way, pico is the the editor for the e-mail client Pine. So if you have used Pine you are already familiar with pico.
It is very useful to know how to use the editor joe (which stands for the "recursive" acronym: Joe's own editor). Joe is the only available text editor in the rescue mode for Red Hat Linux. The rescue mode is a way of accessing a computer that cannot boot to its operating system. This mode is a text only mode (no mouse or GUIs) and it includes only the necessary tools that allow one to restore its failed system. Luckily it has a built in menu for keystroke commands just like pico. To invoke the menu type Ctrl-h k.
Vi (or its "improved" version vim) is an editor with two distinct modes: command and insert. The command mode is used to issue file manipulating commands while the insert mode is for entering text into the file. To learn to use Vi invoke the editor and type :help for instructions.
As mentioned above Emacs/XEmacs can be invoked in a GUI-based or text-based form. To run Emacs/XEmacs in a text-based form in a shell/terminal window type emacs -nw [filename] or xemacs -nw [filename]. The filename is optional. The parameter -nw (short for “no window”) is there to ensure that Emacs/XEmacs will not try to open a new window (which would be an error if you have no graphical desktop support).
Figure 2, Emacs in a terminal window
To get help in Emacs/XEmacs press Ctrl-h and follow the instructions.
To remove the help window press Ctrl-x 1.
Here is a minimal list of basic emacs commands that will start you going:
- exit Emacs/XEmacs Ctrl-x Ctrl-c
- read a file into Emacs/XEmacs Ctrl-x Ctrl-f
- save a file to a disk Ctrl-x Ctrl-s
- write a file to a diks (under a different name) Ctrl-x Ctrl-w
- insert a file into the current buffer Ctrl-x i
- slecet another buffer Ctrl-x b
- kill a bufer Ctrl-c k
- execute a shell command Alt-!
Happy typing away...