Previous Section  < Day Day Up >  Next Section

6.1. Introduction

Mastering a text editor is an important skill for anyone who wants to be a happy, proficient Linux user. Choosing one can get interesting, as the Linux world is overfull of ASCII text editors. There are two reasons for the proliferation of text editors:creating a text editor is a good, and common, project for newbie programmers; and a text editor is a rather personal tool. Linux gurus often write or alter them to suit their own personal whims . . . er, requirements.

Linux users love to engage in flamewars over text editors (especially Emacs versus Vim), which are fun, but pointless. The idea is to find one that suits your needs and temperament. The beauty of Linux, and free/open source software in general, is the wealth of choices for users. There is something for everybody, including entertaining flamewars.

In this chapter we'll look at using JOE, Joe's Own Editor, and Vim, which is a descendant of vi. Why not Emacs? Emacs is a wonderful program; it's big, complex, and endlessly customizable and extensible. It is not a mere text editor; it's more of a complete integrated environment. With Emacs, users can read mail and Usenet posts, write programs, play games, fuss endlessly over custom macros and key bindings, cobble up windowed environments when X Windows is not available, and consult their psychiatrists (M-x doctor). Emacs will do nearly anything you want it to, if you can figure out how. For someone who simply wants to edit text files, it's a bit much. Emacs weighs in at over 22 megabytes, while JOE and Vim both fit on a floppy disk, with room left over.

JOE and Vim are both well suited to the everyday task of editing configuration files. Of course, they can also be used for writing any kind of text file—articles, web pages, coding, whatever you like.

Which brings me to something that may be a bit of an unpleasant reality for some: typing skills matter. The better you can type, the more productive you'll be. For sheer speed and satisfaction, it's hard to beat never having to take your hands off the keyboard, or your eyes off the screen.

Typing Tutor

There is an excellent, free Linux typing tutor called Gtypist (, for anyone who wants a little help. It teaches both QWERTY and Dvorak, and it has typing tutorials in English, Czech, Russian, Spanish, German, French, and Norwegian. Like most ncurses-based programs, it looks better in a text console than in X.

JOE is a "modeless" editor, which means that entering commands and editing text happens on the same screen. Vim has two modes: Normal/Command mode, and Insert/Edit mode. When you're in Normal mode, everything you type is treated as a command. In Insert mode, it's all treated as typed text. This vexes some folks who try Vim for the first time, because there is no helpful animated assistant to tell them that it is necessary to switch between the two modes to get anything done. Vim is a serious power tool, and as you'll see in this chapter, it's not that difficult to learn.

6.1.1 vi/Vim, the Universal Editor

vi (officially pronounced "vee eye," though I like to say "vi," rhyming with "fie," just to be annoying) is the universally available text editor. No matter what sort of Linux system you may find yourself working on, you can count on vi, or one of its many offspring, being present.

vi has inspired a host of cleverly named clones: Vim, elvis, vile, calvin, Vigor, viper, and virus, to name a few. These sorts of projects come and go, but Vim, elvis, and vile are popular and actively maintained. Vigor is noteworthy for its snide animated paperclip, the intentionally annoying Vigor Assistant. The Vigor Assistant continually interrupts your work with "helpful" comments, like "Are you sure you want to move left?" and "Don't cry—it won't help." Vigor is fun, and useful too, because it is an extension of nvi, which is yet another vi clone. Yes, you can do real work with Vigor, though the author himself finds this questionable: "One user actually found Vigor to be useful! After all that time and effort I put into making a totally useless app, somebody has to go and get some benefit out of it."

Moving back to the serious side of the vi ledger, Vim is the most popular vi descendant. When you fire up vi on most Linux distributions, such as Red Hat, Debian, and Mandrake, you get Vim. Vim does windows and color syntax highlighting, and it has extensive online help and documentation. This is handy, because even if you find yourself stuck on a desert island with only the ancestral vi, your Vim skills will serve you well.

6.1.2 JOE, the Five-in-One Editor

JOE has a number of nice features. It has multiple personalities, and onscreen help. You can fire up JOE and start muddling around and editing files without bothering to read any documentation. Of course, this is not the the optimum method, but in a pinch it works.

JOE has three emulation modes:

jstar (WordStar)
jpico (Pico)
jmacs (Emacs)

and two native modes, JOE and RJOE. RJOE is "Restricted JOE"; it can only open files specified on the command line. After RJOE is up and running, you cannot open new files from inside RJOE, or open any command shells. This makes RJOE a good option for your sudo users, preventing them from escaping to a command shell with their rootly powers. All five modes run from the same 200-kilobyte executable.

6.1.3 See Also

    Previous Section  < Day Day Up >  Next Section