Using the Pico Text Editor
This document is intended to provide you with the basic information you need
to use the Pico editor when working on our UNIX system. This document assumes
that you are using your account from some kind of terminal window -- either
by dialing in from home, by using a Macintosh or PC in a computer lab or
office on campus, or by using a window generated by the "Terminal" program
on a Unix workstation.
Why use Pico?
When using your Unix account, you will find that there are three popular
editing tools available for creating or modifying text files: vi, emacs and
pico. Unlike vi or emacs, the Pico display-oriented text editor was developed
for the sake of "simplicity in editing".
Pico (for PIne COmposer) was developed from the Unix emacs editor and designed
for use with the Pine mail system. So, anything you learn about Pico will
also serve as a foundation for your use of the Pine mailer. Both Pico and
Pine tend to document themselves; however, this document intends to summarize
as well as elaborate on the basic features of Pico.
The Pico editor is not only best utilized with the Pine mail system but it
is also the easiest editor to use when you want to edit the files on your
account. When using your account, you can set up a default
editor for use with programs (such as the newsreader tin) in which you
need to create or modify text.
Conventions used in this handout
In this document the word current, when used in reference to some
unit of text, refers to where the cursor is -- e.g., current position, current
line, word or character. This handout also uses several different fonts to
help clarify the meaning of the text.
-
bold text -- This type of text is or words or characters
you type in.
-
italic text -- In addition to placing an emphasis on text, italic
text is used as a general word or phrase for which you must substitute a
specific example (e.g., for filename you might substitute myfile ).
When referring to pressing the Enter or Return key on the keyboard,
we'll simply say "press Return ".
Important Note - Unix is case-sensitive. This means it makes a difference
whether you type commands, filenames, and so on in UPPER or lower case.
Starting Pico
To edit a file with Pico, type any of the following commands at the Unix
system prompt:
-
pico -- creates a new, unnamed file
-
pico filename -- allows you to edit an existing
file or create a new file named filename
-
pico -v filename -- opens filename to view
only; no editing allowed
Once you successfully enter Pico, a window display will appear as illustrated
below:
The Pico window display is divided into four main areas: Status Line, File
Content, Message Line and Command List.
Status Line
The Status Line at the top of the widow shows Pico's version number, the
current file being edited and information pertinent to the status of the
file (or text) during your edit session.
File "Content"
The File Content area is used to enter the text for the file you are creating
or modifying. When you enter text in this area, you need not worry about
pressing Return at the end of the line. Pico has a word wrap feature, similar
to a word processor, which does not require you to press Return when you
get to the end of each line. When you get near the end of a line, and the
word you are typing goes beyond pico's right margin, that word will automatically
shift down to the beginning of the next line while you keep typing. This
feature also works if you insert text into a line. The text following the
inserted text will be pushed pass the right margin and wrapped around to
the next line.
Message Line
The Message Line is located just below the File Content area (i.e., the third
line from the bottom of the window). This line is used to report system messages
to you and for keyboard input when needed.
Command List
At the bottom of the screen is the Command List that displays a menu of commands
from which to select. This is the main menu and through some commands you
will be able to access submenus.
Commands are invoked by what Pico considers to be special control-key sequences.
A control-key sequence is when the control key, represented by a caret (^),
is used in combination with a letter (e.g., ^G). So the Control-G key combination
is indicated on the menu as ^G. Be sure to hold down the control key while
you type G. Note that on some systems certain control-key sequences are diverted
before reaching Pico and you may not be able to use them. However, there
is an optional way to issue Pico commands: you can press the Escape key twice
(i.e., ESC ESC) followed by a letter. For example, instead of using ^C you
would instead use ESC ESC C.
Getting Help (Get Help)
The ^G (Get Help) command gives you a list of Pico commands. The help
information in Pico mentions using "F" function keys for certain commands.
These are not referring to the function keys on the computer you're using
to connect to your Unix system and therefore will not perform the functions
mentioned.
Another feature of Pico is its context-sensitive help. When you access the
main menu and any submenus, you will find help for the feature you are accessing.
For example, when you use the ^O (WriteOut) command, you will notice that
the command list at the bottom of your screen will display the ^G (Help)
command. Now when you press ^G, you will receive help on the ^O (WriteOut)
command.
Moving Around within the File
You can use the arrow keys on your keyboard to move the cursor around in
the usual way (right, left, up, down). There are also Pico commands available
that will enable you to move the cursor around:
-
^F - move Forward a character (or right arrow)
-
^B - move Backward a character (or left arrow)
-
^P - move to the Previous line (or up arrow)
-
^N - move to the Next line (or down arrow)
You will find the commands below helpful in moving to various positions within
your text.
-
^A - move to the beginning of the current line
-
^E - move to the End of the current line
-
^V - move forward a page of text
-
^Y - move backward a page of text
Searching for Text
When using the ^W (Where is) command, Pico allows you to search for
a string of text. This search is not case-sensitive (i.e., searching for
the characters service or SERVICE or Service will all result in finding the
character string "service").
Also, Pico searches for the character string regardless of what is before
or after the characters. So, if you initiate a search for service and you
have the word services in your file, then Pico will find any instance of
services as well as service.
Your search will begin from your current position and continue to the end
of the file. If Pico can't find the character string after it reaches the
end of the file, the search is wrapped around to the top of the file, continuing
until it finds the string or until it arrives back at the initial cursor
position. This is referred as the Pico "search wrap" feature.
Editing Text
^D (Delete) is used to delete the character at the cursor position.
Additionally, the Backspace key or Delete key or Del key (depending on your
keyboard) can be used to delete a character to the left of the cursor position.
^J (Justify) is used to justify (format) a paragraph. Pico considers
a paragraph to be a body of text separated from another body of text by way
of a blank line. In other words, you should have a blank line between each
paragraph. This is important because when you complete a paragraph, you may
find that some lines are much longer or shorter than others because you have
removed or added text. If you have separated your paragraphs with blank lines,
you can position the cursor anywhere in the paragraph and type ^J (Control-
J) to reformat the paragraph. The lines are adjusted so that they are
approximately the same length within the 73-character margins.
Pico gives you the option to unjustify a paragraph by using ^U
(UnJustify). This command is helpful when you are dissatisfied with the
results of ^J. ^U (UnJustify) is only available for you to use immediately
following ^J.
A line longer than the screen width may develop from joining lines, or inserting
and/or deleting text within lines. Pico indicates the occurrence of a very
long line of text by displaying a dollar sign ($) in the last position of
the line. The text for a long line may disappear off the right edge of the
screen but you can scroll through the line by using your arrow keys. Generally,
it is not a good idea to maintain your file with long lines and it is suggested
that you use the justify feature for text alignment.
^T (To Spell) is used to check for spelling errors in the text of
the file. When you use spell checking, it begins to alphabetically search
for misspelled words. Pico will scan your text for words that aren't in its
dictionary, and if it finds any, it will highlight the word and prompt you
for a replacement word. If you don't want to change the word, just press
Return and the word will remain unchanged. To cancel spell checking at any
time use ^C (Cancel).
The Pico editor was designed for use with the Pine mailer, which treats the
">" symbol as a special character. The ">" symbol is a signal Pico
uses to indicate a line of text quoted from somewhere else. So when you run
spell checking, it will not check for misspelled words on any line that begins
with the ">" symbol.
Cutting, Pasting and Copying Text
The Cut and Paste process allows you to remove (cut) a body of text and place
(paste) it in a destination position. The Cut command will cut one line of
text unless you designate a specific body of text to cut.
To cut and paste one line of text, use the following steps:
-
Move your cursor to the line you wish to cut and type ^K (Cut). The line
will disappear from your screen. This line has now been placed in what is
called a buffer (a temporary storage area).
-
Move your cursor to the destination position (where you would like to insert
the text that is now in the buffer) and type ^U (Uncut) to paste your text.
The type of "cutting" described above is limited to whole lines. However,
you can cut more than one line. When you use ^K successively, you will continue
to add these lines to the contents of the buffer until you use the ^U command
(i.e., until you paste).
If you want to cut and paste a specific block of text, use the following
steps:
-
Move your cursor to the position where you would like to begin your cut and
type ^^ (Mark), i.e., Control-^. Notice that the message line at the bottom
of the screen displays the message
[Mark Set] indicating that
you can now begin to specify the block of text that you want to cut. You
can cancel this operation at any time before you do the cut by using the
^^ (Mark) command again. When you cancel, the status line will display the
message [Mark Unset].
-
Move your cursor up, down, left or right to highlight the block of text you
wish to cut.
-
After you have highlighted your block of text, type ^K (Cut) to place the
text in the Pico buffer.
-
Move your cursor to the destination position (i.e., the new area to which
you are moving your body of text to) and type ^U (Uncut) to paste the text.
To copy text simply cut it as usual using the ^K command, and then immediately
do a paste (^U) to restore it. Now, move the cursor to the new destination
and type ^U again to do a second paste. You can paste the same text as many
times are you like until the next ^K command clears and replaces the buffer's
contents or you exit from Pico.
An important note to word processing users: Macintosh and Windows communications
programs also allow their own copying and pasting (usually from the program's
Edit menu). You can copy text from a word processor on your own computer,
go to your communications program and use the Paste command from the Edit
menu to paste the text into Pico. The text will be treated as if you had
just typed it in. All lines (except those that end in a "hard" return in
your word processor) will wrap nicely in Pico.
File Manipulation
^R (Read File) is used to insert (read) a specific file from your
Unix account into your document at the current position. Lines brought in
using the ^R command remain exactly as they were in the original file from
which they were read -- there is no word wrapping.
A companion to this command is ^O (Write Out) which allows you to
save your text to a given filename on your account without exiting from Pico.
The ^O command also gives you the convenience of saving intermediate stages
of your editing session.
The Pico File Browser
When you access ^R or ^O, your command line will display another submenu
of commands. Included in this submenu of commands is ^T (To Files). The ^T
(To Files) command on this submenu provides a route to a list of files, just
in case you can't remember the name of the file you want to read in (^R)
or you don't 'know if the filename already exists for the file you want to
write out (^O).
^T (To Files) gives you access to the Pico file browser as illustrated
below:
The file browser displays the files and directories available on your Unix
account. If you initiate the browser using the ^R command, it will allow
you to use the cursor keys to select a file to insert (or read into) your
current edit session. This insertion is based on the position of your cursor
within the file content area of your screen. If you initiate the browser
using the ^O command, again, you can use the cursor to select a file. However,
when you press Return, you will be asked if you want to overwrite the highlighted
file with the file you were working on in your file content area. Caution
should be used when overwriting files.
The browser allows you to use other commands simply by entering a letter.
You are allowed to rename (R) and search (W) for files and directories, copy
(M) and delete (D) files and go to (G) another directory, as well as page
through your list of files and directories.
Exit and Save a file
^X (Exit) from the main menu will allow you to exit and save your
file. If you have entered any text during your editing session, Pico will
attempt to save the text that has been placed in a temporary buffer when
you type ^X. If you indicate that you want to save the buffer contents, by
typing y when prompted, Pico will then prompt you for a filename. If the
file does not exist, Pico will create it. If the file exists, Pico will prompt
you to confirm whether you want to overwrite the file with the modified text.
(To quit out of a file without saving changes, type n when prompted about
your intentions to save the buffer contents.)
The ^X (Exit) command can also be found on certain menus that you may enter
(i.e., submenus); typing ^X (Exit) from within these submenus will simply
return you to the main menu.
Miscellaneous Commands
^L (Layout Display) will allow you to refresh your screen. From time
to time, your screen may become distorted or garbled with unwanted characters.
^L will allow you to "repaint" your screen for normal viewing.
^C (Cursor Position) from the main menu can be used to show the line
number for your current position. This information (displayed on the message
line) will also indicate the total lines and characters within your file.
Making Pico your default editor
As mentioned earlier, Pico is the easiest editor to use when you want to
edit the files on your account. It is also the easiest to use in other text-entry
situations, such as posting an article to a Usenet newsgroup. To make sure
your favorite newsreader lets you use Pico for this purpose, you must make
Pico your default editor.
Several files in your account control how the account operates, including
the choice of a default editor. The names of these files all begin with a
period (pronounced "dot"). The .cshrc and .login files are
the most important, since they set up your account when you log in. To make
Pico your default editor, add two lines to your .cshrc file. Start
by typing:
pico .cshrc
at a Unix system prompt to enter the .cshrc file. Then use the arrow
keys (or type ^V) to move to the end of the file. Once you are on a blank
line, use the correct spacing and letter case to type in the following two
lines,:
setenv EDITOR /usr/bin/pico
setenv VISUAL /usr/bin/pico
pressing Return at the end of each line. When you have finished, type ^X
(Exit). When you are prompted to save the modified buffer, type y for yes.
Then you will be asked for a filename, and .cshrc will appear as the
default. Press Return to accept the default filename .cshrc. After
you press Return, your file will be saved and you will back at the Unix system
prompt. These changes won't take effect until the next time you log on, so
if you want Pico to be your default editor immediately, you need to log off
and log on again.
From the Computer Science
Center
at the
University of
Maryland
.