Doctor Bob
Linux Topic Search
TOURBUS
HOME PAGE
SAVVY
CONSUMER
FREE TECH
SUPPORT

LINUX TEXT EDITORS

Can Pico Slow the Rotation of the Earth?

The Pico Editor

Pico, short for Pine Composer, started life as the built-in editor for the Pine email program. Lots of people use Pico as a text editor because they also use the friendly Pine program for email.
The Pico text editor doesn't have a lot of fancy features, but it's a welcome alternative to the vi or Emacs editors because learning it is quick and easy. Cursor movement and text entry are straightforward, and--best of all--you don't have to learn any arcane commands: all commands are listed in a handy menu at the bottom of the screen.

To start Pico, enter a command like this:

pico bulb.joke

In response, you should see the file bulb.joke displayed on your screen in Pico, ready for editing, as shown here:

UW PICO(tm) 4.3 File: bulb.joke



Q: How many surrealists does it take to screw in a light bulb?

A: Two--one to hold the giraffe, and the other to fill the

bathtub with brightly colored machine tools.







[ Read 3 lines ]

^G Help ^O WriteOut ^R Read File ^Y Prev Pg ^K Cut Text   ^C Cur Pos
^X Exit ^J Justify  ^W Where is  ^V Next Pg ^U UnCut Text ^T To Spell

Getting around in Pico

Before we explore Pico commands, here's a summary of how to navigate your way around a file in Pico.

Positioning the Cursor

® Move cursor one space right (also ctrl-N).
¬ Move cursor one space left (also ctrl-P).
­ Move cursor up one line (also ctrl-F).
¯ Move cursor down one line (also ctrl-B).
del Delete character at cursor (also ctrl-D).
ctrl-Y Move backward one screen (maybe F7).
ctrl-V Move forward one screen (also F8).
ctrl-A Move cursor to beginning of line.
ctrl-E Move cursor to end of line.


With the exception of the ctrl-Y (page down) command, text entry and cursor handling are identical to that of the Emacs editor, so we won't cover that again here.

The Pico Menu

When you start Pico you'll see this menu of commands:

^G Help ^O WriteOut ^R Read File ^Y Prev Pg ^K Cut Text ^C Cur Pos

^X Exit ^J Justify ^W Where is ^V Next Pg ^U UnCut Text ^T To Spell

Here's a list of what they mean. Note that the circumflex (^) stands for ctrl.

Pico Commands

ctrl-G Display help screens.
ctrl-O Write file to disk.
ctrl-R Read another file.
ctrl-K Cut line or marked text.
ctrl-C Display cursor position.
ctrl-X Exit from Pico.
ctrl-J Reflow the paragraph.
ctrl-W Search for text.
ctrl-U Paste (uncut) text.
ctrl-T Run spelling checker.

Trying Out Some Pico Commands

Now let's try out some Pico commands.

Saving and Exiting

Saving your file is easy with Pico--just press ctrl-O to write your file to disk and remain in the editor, or press ctrl-X and respond y to the Save Modified Buffer? prompt to save and exit.

If you want to exit from Pico without saving your file, press ctrl-X and respond n to the Save Modified Buffer? prompt.

Inserting Another File

To insert another file into the one you're currently editing, position the cursor where you want to insert the file, press ctrl-R, and enter the name of the file you wish to insert at the prompt that appears on your screen:

Insert file from home directory: ______________
^G Get Help ^T To Files
^C Cancel

If you can't remember the name of the file to insert, press ctrl-T to display a list of all your files. If you ultimately decide not to insert it, press ctrl-C to cancel.

Cutting and Pasting with Pico

If all you want to do is cut and paste a line of text, you can use ctrl-K to delete the current line and ctrl-U to paste it somewhere else. Pico also lets you cut and paste blocks of text. Put your cursor on the word light on the first line of the bulb.joke file and press ctrl-^ ( the circumflex is the shifted 6 key).

Nothing happens right away, but as you move the cursor, it highlights a block of text. Move the cursor to the end of the word giraffe on the next line--your file should look like this:

UW PICO(tm) 4.3 File: bulb.joke



Q: How many surrealists does it take to screw in a light bulb?

A: Two--one to hold the giraffe, and the other to fill the

bathtub with brightly colored machine tools.

Once you've marked a block of text, ctrl-K acts a bit differently from before. Instead of deleting the entire line where the cursor is located, it deletes the highlighted block. You can then use ctrl-U to paste the deleted block elsewhere.

Tip: You don't have to paste the deleted text right away, or ever. ctrl-K can be used simply as a handy way of deleting unwanted text. (Deleted text goes to an invisible clipboard, and it disappears once you delete more text.)

Pico Bells and Whistles

Pico has a few nifty features you might not expect to find in a simple text editor. For example, ctrl-J will justify the sentences in the current paragraph. Type a bunch of short sentences on separate lines and try it. If you don't like the results, ctrl-U will undo the operation.

Pico also has a built-in spelling checker you can call up with ctrl-T from within a file. If Pico doesn't find any dubious words in the current document, nothing much happens except that the message "Done checking spelling" appears at the bottom of the screen.

And if you'd like to know exactly where you are within a file (on which line and at which character), or if you'd like a quick character or line count, press ctrl-C and look in the message area at the bottom of the screen for something like this:

line 2 of 4 (50%), character 65 of 173 (37%)

Parting Words about Pico

Pico is my personal favorite in text editors because it's easy to use and starts quickly. Pico is under constant development at the University of Washington. For more information, you can visit the Pine Information Center on the Web at http://www.washington.edu/pine. You can even download the latest version of Pico for Linux there.

Previous Lesson: The Emacs Editor
Next Lesson: Slicing & Dicing

[ RETURN TO INDEX ]

Comments

No comments yet

*Name:
Email:
Notify me about new comments on this page
Hide my email
*Text:
 

Ask Bob Rankin - Free Tech Support
<Send This Link to a Friend>         <Bookmark This Page>


Copyright © by Bob Rankin
All rights reserved - Redistribution is allowed only with permission.