Because Unix and Linux are rooted in the hacker/geek/programmer culture, where coding was (and is) the most important function of any computer, having robust shells and editors were essential parts of the experience. It is no accident that Bill Joy wrote both the C shell and the vi editor, nor that Richard Stallman created the GNU Project and the emacs editor (and that each has completely different views about how to create and license software). Of course, that was in the bygone early days of Unix. Why does it matter what text editor you should use now? And why do you need one, anyway? Consider this: Word processors are wonderful things, but often they are the very essence of overkill. One of the beauties of Linux is that nearly all the configuration and customization options for applications are contained in simple text files. This is true whether the program has a GUI or not. So making changes in the way a program works doesn't necessarily have to require opening the program; just open the config file in a text editor! There's one other reason to be at least somewhat comfortable with at least one nongraphical editor. One of the truly cool things about Linux is the capability to access many different computers regardless of where you happen to physically be located at a given moment. Remote access to other servers and workstations is another beauty of Linux, but most times, those remote machines (especially the servers) don't even have X installed. To get any work done, you need a text editor. SUSE Linux offers no fewer than 22 text editors through YaST, as shown in Table 5.1. Don't be overwhelmed by the number of choices, though. Basically, text editors fall into one of two major camps: editors that behave like vi and editors that behave like emacs. This list also has a few line editors that work directly in the shell.
The next few sections will help you work with these various editors. Working with vim and Its ClonesThey say that vi is hard to learn, but once you get there, you can do amazing things with it. That hard-to-learn part is evident from the first time you use it (unless you have a vi user nearby). When you first open the vi editor (and these days, typing vi actually opens its "improved" version, vim), you cannot type anything. By default, vi opens in its command/viewing mode. You can maneuver around a file, provided you know that commands in vi begin with a colon (:). To edit a file, you must press the Insert key (or Esc-i) first. After you know this secret handshake, vim can be very useful and, with practice, very powerful. It also comes with extensive documentation. The documentation page at the Vim.org site says it best: "The most useful software is sometimes rendered useless by poor or altogether missing documentation. Vim refuses to succumb to death by underdocumentation." To quickly get up to speed in vim, you don't have to run the editor. Run vimtutor from the shell prompt to get a brief tutorial, estimated to take about 30 minutes to complete. Following are a few commands that will help you get started with vim:
Gvim and Kvim both offer GUIs for the basic editor. They were written for GNOME and KDE, respectively, but you can use either one in either environment. The primary development team for Kvim has moved on to produce another GUI-based vi clone called Yzis. Nvi is a slightly different version of vi from the University of California at Berkeley. Working with Emacs and Its ClonesGNU emacs is the infinitely customizable, everything-but-the-kitchen-sink editor/work environment. It was the first product of the GNU Project, and so is beloved by many free-software purists. It is the text editor that keeps your hands busy over the keyboard with seemingly odd multiple keybindings (Ctrl+X to begin a command and another combination to complete it). Learning emacs is a supremely geeky thing to do. If vim has everything an editor should have in one pretty, if sometimes impenetrable, package, emacs is a modular monster. Emacs reads email and Usenet newsgroups, browses the web and composes web pages in HTML, XHTML, XML, and sundry other formats as well. It offers a development environment for practically every extant programming language. You can even see a sublimely odd conversation between Zippy the Pinhead and a psychoanalyst. But to do all this, you must have the proper mode installed. Emacs is a big program (taking up to 30MB), but it does not include every mode that has been written. Sometimes you have to go hunting for the thing you need. Emacs is easy to start up (type emacs <filename> from the shell prompt), and navigation can be pretty easy. Unlike vim, Emacs has its own interface (vim just shows up in the shell) with menus and mouse support, although not quite as pretty as under X. Unless you include a mode command when you launch it, emacs assumes you want to write text and loads in text fill mode. If you don't want words to wrap at the end of a line, go to the Options menu or type Alt+X+auto-f[TAB] to change the mode. Emacs also has a tutorial that will walk you through the basic commands and navigation tools. In emacs, use Ctrl+H, and then press "T" to get to it. Most of the other clones of emacs (aficionados use the plural emacsen) are subsets of the original designed for specific uses. XE began as a GUI version, but has a separate group of developers that have done some things differently from its parent. Generally speaking, XEmacs is faster to add new features and does not require packagers to assign copyright to the Free Software Foundation (that administers the GNU Project). Some of the OthersYou don't need to follow the crowd when choosing an editor. Choices are not limited to the big two. Take these for a spin:
|