h1

Pico tips

June 16, 2006

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.

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).

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%)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: