What is a text editor?
A text editor is a program for creating and modifying files containing
ordinary text. Text editors don't usually have features for formatting
output to create papers or documents so they're not word processors.
Some uses of a text editor include:
-
creating and modifying program source files for compilation
-
creating and modifying html files to use in a Web page
-
creating and modifying other files used as input to other programs
The text editors that are available on grove, the CIRCA Unix system, are
pico, joe, vi, and emacs. All of these editors are full-screen editors,
but they will only work correctly if used with the proper terminal type.
If you are using a PC or Macintosh from home, your terminal emulation
software should emulate a VT100 terminal.
Using the control key
You'll need to know how to use the control key. The control key is
usually labeled Ctrl on your keyboard and is used like a shift key. You hold
down the control key and then press some other
key on the keyboard. There are several short-hand methods used to show a
control
key in help screens or in documentation. Some of the ways to show "control
x" include:
Usually, upper case and lower case are not the same in Unix; however, when
you use the control key, the other key pressed
can be either upper or lower case. Ctrl/X and Ctrl/x are the same thing.
The examples are shown in upper case because it's easier to distinguish one
letter from another.
The Pico Editor
The Pine Composer (pico) is the simplest text editor to use.
If you've used the pine mail program to send electronic mail,
you've already used pico.
Enter this command to create or modify a file using pico:
pico filename.
You can't get lost in pico if you look at the bottom of the screen.
You'll always see a summary of available commands or a question that
pico is asking you. You should be able to use your cursor keys to
move around in the file. If they don't work there are control keys to do
the same thing.
| Important pico commands: |
| ^G | display help screen |
| ^X | exit from pico |
| Pico commands to move around in the
file: |
| ^V | scroll forward one page |
| ^Y | scroll backward one page |
| ^P | move to previous line |
| ^N | move to next line |
| ^E | move to the end of the line |
| ^A | move to the beginning of the line |
| ^W | search for text |
| Pico commands to
delete text: |
| ^D | delete character under cursor |
| ^K | "cut" current line under cursor |
| ^U | restore the cut line at the cursor
position |
| Pico commands to manipulate blocks of
text: |
| ^^ | mark start of text to select
(yes, that's Ctrl-^) |
| ^K | cut selected text |
| ^U | uncut or paste selected text |
The Joe Editor
Joe's Own Editor (joe) is almost as easy to use as
pico but has many more features. Enter this command to create or
modify a file using joe:
joe filename.
joe is based on the control keys used in Wordstar and Borland's
programming editors. Many joe commands are invoked by typing
Ctrl/k followed by another key. Here are some important ones:
| ^KH | show help screen |
| ^KX | save file and exit |
| ^KQ | quit without saving the file |
Note that the second character in the sequence is not a control character.
Sometimes, but not always, it will still work correctly if you hold down
the control key when you type the second character.
Your cursor keys should work for moving through the file. Depending on
your terminal emulation, you might also find that the Page Down and
Page Up keys will scroll through the file. If these keys don't
work, there are control keys that will do the same thing.
| joe commands to move around in the
file: |
| ^V | scroll forward one screen |
| ^U | scroll back one screen |
| ^X | move to next word |
| ^Z | move to previous word |
| ^P | move to previous line |
| ^N | move to next line |
| ^E | move to the end of the line |
| ^A | move to the beginning of the line |
| ^KU | move to the top of the file |
| ^KV | move to the end of the file |
| ^KL | go to a specific line number |
| joe commands to delete text: |
| ^D | delete one character |
| ^W | delete one word |
| ^Y | delete one line |
| ^_ | undo last delete
(Note: On some older terminals, ^_ might not work. Try ^?
instead.) |
| joe commands to manipulate blocks of
text: |
| ^KB | mark start of block |
| ^KK | mark end of block |
| ^KC | copy marked block to current
location |
| ^KM | move marked block to current
location |
| ^KY | delete marked block |
| joe commands to search for or replace
text: |
| ^KF | search and replace |
| ^L | search for next occurence of text |
joe saves the previous version of a file when you edit it by
putting a ~ character at the end of file name. If you change the file
xyz then you'll find the new file in xyz and the old file in
xyz~.
joe can also be used in modes that imitate the pico or
emacs editor. For more information on joe and its features,
type man joe.
The vi editor
The vi editor is one of the original Unix text editors. It can be
clumsy to use but you will find it documented in almost any book on Unix.
If you're accustomed to using it, it's available, but we don't recommend
it for new users.
For information on using the vi editor, type
man vi.
The CIRCA handout Using the
vi editor describes this editor in more
detail.
The emacs editor
emacs is a powerful editing environment popular with many serious
Unix users. Enter this command to create or modify a file using
emacs:
emacs filename.
Essential emacs commands are:
^HT display emacs tutorial
^X^C exit from emacs
Type this to see the online manual page for emacs:
man emacs.
The CIRCA document
Using emacs on
the CIRCA Unix system and the
GNU Emacs Reference
Card can get you
started.
|