This document is a local UB adaptation of the PICO tutorial developed at North Carolina State University. The original document can be found on the Web at http://www2.ncsu.edu/ncsu/cc/pub/tutorials/pico_tutor/pico.html, and is copyright 1997 by NCSU.
pico filename
at the system prompt where filename is either the name of the file you want to edit (one that already exists) or the name you want to give to a new file you want to create.
In the list of commands at the bottom of the PICO screen, the caret (^) stands for the control (ctrl) key. ^G means to hold down the control key and press G. PICO commands are always a combination of the control key and another key. Also, when you enter a PICO command you don't need to press the return key.
You can easily edit short files with only the following keys:
Now that you have an empty file, you can start typing. PICO automatically starts a new line when you run out of room (called "wrapping text," "text wrap," or "autowrap") so you don't need to watch the screen while you type.
Press [return] when you want to start a new line. If you want a blank line between lines of text or data, press [return] twice.
If you make any mistakes while typing, just use the backspace key to erase the mistake.
Mary had a little lamb, its fleece was white as snow, and everywhere that Mary went the lamb was sure to go.
It followed her to school one week
to see what it could find,
it then learned French so well
it blew little Mary's mind.
To save a file, use ^o, which stands for writeOut because you're writing what you've done to a file as output. When you press ^o, Pico will prompt you for the filename. If the file doesn't have a name yet, you'll need to type one in. If the file does have a name, it will follow the file name prompt, and all you need to do is press [return].
If you're proofreading your file by looking at a printout of it, it can tricky to find the specific line you want to revise. An easy way to get to the right point in your file is to use PICO's search, or Whereis, command, which is ^w. This command lets you enter a character(s) or word(s) to search for, and then moves the cursor to the first occurrence. PICO begins the search from the point in the file where the cursor is located. So, if the cursor is at the beginning of the second paragraph, the search begins at the beginning of the second paragraph.
To find a specific character or word, press ctrl-w (for where is). A black strip with Search: will replace the two lines of commands at the bottom of the screen. You should then type the character(s) or word(s) you want to find. This search command is not case sensitive -- if you type Lamb at the search prompt, the system would find lamb. This search command is also not limited to finding only whole words. For example, if you were to tell PICO to find th, it would find that, the, they, and the.
Cutting, or deleting, text is usually a major component of any kind of
editing. PICO gives you two ways to cut text: you can cut it a
character at a time or a line at a time. (Unfortunately, you can't cut it a
word at a time.)
To delete a character, place the cursor on the character you want to delete
and press ctrl-d. Pressing your keyboard's delete key (some
keyboards label it backspace) will delete the character preceding the cursor.
To delete an entire line, place the cursor anywhere within the line and
press ctrl-k (for kill or cut text). The entire line will then be cut.
If you change your mind about deleting the line before you delete another
one, you can press ctrl-u to bring back the line. The restored line will be
placed wherever the cursor is (even in the middle of another line).
Since ctrl-u lets you restore the cut line wherever the cursor is and not
just to wherever it came from, you can use ctrl-k and ctrl-u to "cut and
paste" text.
In PICO you move blocks of text pretty much as you
would if you were using a microcomputer word processing package. You first
need to mark (highlight) the text you want to move. Then you cut the text,
move the cursor to where you want the text inserted, then paste it.
2. Press ctrl-^ (ctrl-shift-6 keys).
3. Move the cursor to the end of the block you want to cut. The text
should then be highlighted.
4. Once the block is highlighted, press
ctrl-k to cut the text.
5. Place the cursor to where you want the text
placed, and press ctrl-u. The text should then appear.
To justify a paragraph (fill in gaps left by starting a new line) enter
ctrl-j. PICO defines paragraphs as text surrounded by blank
lines or indentation. For example, suppose you had the following lines in
your text file:
It blew little Mary's mind.
If you don't like the result of the justified text, before you move the
cursor outside the paragraph press ctrl-u to "unjustify" the
paragraph. Once you've justified text, the ctrl-u command's function changes
from undelete to unjustify. However, when you move the cursor from the
justified paragraph, the ctrl-u command function returns to undelete.
Therefore, if you need to unjustify the paragraph, you must do so before you
move the cursor outside the paragraph. To join lines that are
separated by blank lines (in the example above to move our "it blew little
Mary's mind" so it was immediately below "it then learned French so well")
use ctrl-k to delete the blank line and then use ctrl-j to fill the
paragraph.
Mary had a little lamb, its fleece was white as snow, and everywhere that Mary
went the lamb was sure to go.
It followed her to school one week
Change "Mary" to "Fidel" The cursor should move to the first "Mary". Move the last line ("it blew little Mary's mind")
to the third line
Now make
the three last lines one continuous line It followed her to school one day to see what it could find, it then
learned French so well
PICO offers a spellchecker that will check the spelling in your text files.
To start the spellchecker press ctrl-t. The PICO
spellchecker compares the words in your file to words that are in its
dictionary. When it finds a word that isn't in its dictionary, it sends the
prompt Edit a replacement: followed by the misspelled word. If the
word is correct, just press return. If the word is misspelled, you can change
it by backspacing over it (to delete it) and then typing the correct word.
You can also use the cursor and delete keys to edit parts of the word.
To insert a file into the one you are currently editing, place the cursor
where you want to place the inserted file. Then press
ctrl-r. After you press ctrl-r you'll receive the prompt
Insert file: Enter the name of the file you want to insert and press return.
The inserted file's contents will be inserted at the cursor. This command
does not delete or in any way alter the file that is to be inserted (a copy
of the file is inserted). If you change your mind about inserting the
file after you've pressed ctrl-r, when prompted for the filename enter any
character string that doesn't correspond with a file. The system will attempt
to process the command, but when it doesn't find a corresponding file it will
cancel the command and your text will not be altered. You will, however,
receive the message No such file: followed by the character string you
entered.
Press ctrl-x to quit (or exit) PICO. The system will prompt you
with a message asking if you want to save your changes. Y saves the changes
and N quits PICO without saving what you've done since the last time you
saved.
If you dial in to your account but don't do anything (such as press a key)
for some time, there's a good chance you will be disconnected. This won't
happen, however, if you're using Pico; it will only happen if you're at the
system prompt.
If for some reason you can't use cursor (arrow) keys, you can use the
following commands to move around in your file.
If your display
becomes cluttered (most likely because of interactive messages), you can
clear or refresh it by entering ctrl-l. The messages are erased from your
screen and the file you are working with remains.
Deleting characters and lines and bringing them back again
1. Position your cursor at the beginning of the first line of the text
block you want to move.
Filling paragraphs
It followed her to school one week
If you were to place the cursor within the first
three lines and press ctrl-j, the text would then look like the following:
to
see what it could find,
it then learned French so well
It blew little Mary's mind.
It followed her to school one week
to see what it could find,
it then learned French so well
However, if you had a blank line between each line of text pressing ctrl-j
would not affect the text.
Trying it out: find, delete, undelete, and justify
Here you can practice editing the text you entered in to mary_lamb.txt. Your
file probably looks something like this:
to see what it could find,
it
then learned French so well
it blew little Mary's mind.
Fidel had a little lamb, its
fleece was white as snow, and everywhere that Fidel went the lamb was sure to
go.
it blew little Fidel's mind.
Spellchecker
Trying it out: Spell Checking
Run the spellchecker on your file. It should identify ``Fidel'' as
being misspelled. Of course, it isn't, but ``Fidel'' is not in PICO's
spelling dictionary, so it thinks that it's misspelled. Let's
make believe that it is a misspelled word, and that you want to correct
it to be your own name. So: Using the spellchecker, change all
occurrences of ``Fidel'' to be your own name.
Copying an existing file into your PICO file
Trying it out: Inserting a file into PICO
Move your cursor to the line just below the last line of your text.
Insert the file: .cshrc
Ending a PICO session
Other good things to know about PICO
Timeout
Ctrl-keys for moving around in a file
ctrl-p move to the Previous line.
ctrl-n move to the Next line.
ctrl-f move Forward a character.
ctrl-b move Backward a character.
Clearing the display
William J. Rapaport
(rapaport@cse.buffalo.edu)
file: UB.pico.tutorial.26ag99.html