Choosing an Editor


Basically, all editors are designed to do the same things: enable you to create, modify, and save text files. These files could include configuration files, email messages, or shell scriptsessentially any text file you can create. Exactly which editor you choose is up to you, depending on your specific needs and how much you're willing to learn.

In this book, we'll stick to three biggiespico, vi, and emacswhich will likely give you all the capabilities you'll need. We chose these because pico is (arguably) the easiest Unix editor to use, vi is one of the most powerful and is available on almost every Unix system, and emacs provides an unbelievable number of options and is a handy tool for the up-and-coming Unix pro to have.

About pico

pico is one of the more straightforward Unix editors and has become quite popular because it's extremely easy to use. In particular, as shown in Figure 4.1, it's menu-driven and intuitive. All of the commands are visible, and you can open, modify, and close files with little effort. pico is a great choice if you're just getting started with Unix or if you won't be needing an editor able to leap tall files in a single bound.

Figure 4.1. pico offers onscreen command reminders to make it easier to use.


pico is distributed with the pine email program, so if you have pine available to you, you likely also have pico. (See Chapter 1 for a reminder on how to find out if pine and pico are available to you.) If pico is not available to you, ask your system administrator to install it.

Editors Abound

By the way, dozens of other editors exist, such as

  • ed, ex, and red, which are simple (in functionality, but not necessarily usage) line-by-line editors

  • joe and jed, which are fairly simple editors and comparable to pico in many ways


About vi

Although vi is likely responsible for much of Unix's reputation for being complicated and confusing, it offers enormous power and flexibilityit will leap tall files in a single bound and do much, much more. Plus, vi is universally available (unlike pico), so for these two reasons, you should consider taking the time to learn it. You might find vi cryptic, counterintuitive, and nitpicky, and for this reason, you might want to choose a different editor if you won't require vi's capabilities. As Figure 4.2 shows, if you use vi, you won't have menus at your disposalyou'll have to get used to using commands like :q or :%s/vi is arcane/vi is powerful/.

Figure 4.2. vi gives you a clean screen and makes you remember all of its cryptic commands.


About emacs

With emacs, you start to understand how incredibly customizable Unix can be. It can be "just" an editoralthough a very powerful one with all kinds of helpful featuresor it can be an email program, file manager, or darn near anything else. We're going to stick to just the editorial functions, but if you find that you like emacs, don't hesitate to explore the Web for other options and features of this editor. Figure 4.3 shows you what to expect from emacs, including the handy (and fairly familiar) menus.

Figure 4.3. emacs provides both menus and power, all at once.


Tips

  • You're not bound to one editor or another. You can use any editor at any time. We often use pico for email or plain writing because we can type without thinking. We switch to vi when we really need power or just want to make a quick edit without pico's menus, which often seem cumbersome to us.

  • You can specify a default editor that will start automatically in programs that start up an editor for you. Chapter 8 provides details about setting your editor environment variable.

  • See Chapter 8 for more information about configuration files, Chapter 10 for more information about shell scripts, and Chapter 11 for more information about email.

  • If you type pico and get an error message telling you that the command is not found, use find, whereis, or ls to search through the likely directories (/usr/bin or /usr/local/bin) to see whether the program is available but not located where your shell can find it. See Chapter 1 for a quick review.

  • After you establish a file and start adding content, save your changes using the instructions in the next section.

  • You can get helpful information about pico's features by accessing pico help. See the section called Getting Help in pico later in this chapter.





Unix(c) Visual Quickstart Guide
UNIX, Third Edition
ISBN: 0321442458
EAN: 2147483647
Year: 2006
Pages: 251

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net