other versions
JOE(1) | General Commands Manual | JOE(1) |
Name¶
joe - Joe's Own EditorSyntax¶
joe [global-options] [ [local-options] filename ]...Description¶
JOE is a powerful ASCII-text screen editor. It has a "mode-less" user interface which is similar to many user-friendly PC editors. Users of Micro-Pro's WordStar or Borland's "Turbo" languages will feel at home. JOE is a full featured UNIX screen-editor though, and has many features for editing programs and text.Usage¶
To start the editor, type joe followed by zero or more names of files you want to edit. Each file name may be preceded by a local option setting (see the local options table which follows). Other global options, which apply to the editor as a whole, may also be placed on the command line (see the global options table which follows). If you are editing a new file, you can either give the name of the new file when you invoke the editor, or in the editor when you save the new file. A modified syntax for file names is provided to allow you to edit program output, standard input/output, or sections of files or devices. See the section Filenames below for details.Command Line Options¶
The following global options may be specified on the command line:- -asis
- Characters with codes above 127 will be sent to the
terminal as-is, instead of as inverse of the corresponding character below
128. If this does not work, check your terminal server.
- -backpath path
- If this option is given, backup files will be stored in the
specified directory instead of in each file's original directory.
- -baud nnn
- Set the baud rate for the purposes of terminal screen
optimization. Joe inserts delays for baud rates below 19200, which
bypasses tty buffering so that typeahead will interrupt the screen output.
Scrolling commands will not be used for 38400 baud. This is useful for
X-terms and other console ttys which really aren't going over a serial
line.
- -beep
- Joe will beep on command errors and when the cursor goes
past extremes.
- -columns nnn
- Sets the number of screen columns.
- -csmode
- Continued search mode: a search immediately following a
search will repeat the previous search instead of prompting for new
string. This is useful for the the ^[S and ^[R commands and for when joe
is trying to be emacs.
- -dopadding
- Joe usually assumes that there is some kind of flow control
between it and the tty. If there isn't, this option will make joe output
extra ^@s to the tty as specified by the termcap entry. The extra ^@s
allow the terminal to catch up after long terminal commands.
- -exask
- This option makes ^KX verify the file name that it's about
to write.
- -force
- This option makes sure that the last line of the file has a
line-feed which it's saved.
- -help
- The editor will start with the help screen on if this
option is given.
- -keepup
- Normally the column number and control-key prefix fields of
the status lines are on a one second delay to reduce CPU consumption, but
with this option they are updated after each key-stroke.
- -lightoff
- The block highlighting will go away after any block command
if this option is given.
- -lines nnn
- Sets the number of screen lines.
- -marking
- Text between ^KB and the cursor is highlighted (use with
-lightoff and a modified joerc file to have drop-anchor style block
selection).
- -mid
- If this option is set and the cursor moves off the window,
the window will be scrolled so that the cursor is in the center. This
option is forced on slow terminals which don't have scrolling commands.
- -nobackups
- This option prevents backup files.
- -nonotice
- This option prevent the copyright notice from being
displayed when the editor starts.
- -nosta
- This option eliminates the top-most status line. It's nice
for when you only want to see your text on the screen or if you're using a
vt52.
- -noxon
- Attempt to turn off ^S/^Q processing. This is useful for
when joe is trying to be WordStar or EMACS.
- -orphan
- When this option is active, extra files on the command line
will be placed in orphaned buffers instead of in extra windows. This is
useful for when joe is trying to be emacs.
- -pg nnn
- This specifies the number of lines to keep after PgUp/PgDn
(^U/^V). If -1 is given, half the window is kept.
- -skiptop nnn
- Don't use the top nnn lines of the screen. Useful for when
joe is used as a BBS editor.
- +nnn
- The cursor starts on the specified line.
- -crlf
- Joe uses CR-LF as the end of line sequence instead of just
LF. This is for editing MS-DOS or VMS files.
- -hex
- Sets the buffer to hex edit mode.
- -wordwrap
- Joe wraps the previous word when you type past the right
margin.
- -autoindent
- When you hit Return on an indented line, the indentation is
duplicated onto the new line.
- -overwrite
- Typing overwrites existing characters instead of inserting
before them.
- -lmargin nnn
- Sets the left margin.
- -rmargin nnn
- Sets the right margin.
- -tab nnn
- Sets the tab width.
- -indentc nnn
- Sets the indentation character for ^K, and ^K. (32 for
SPACE, 9 for TAB).
- -istep nnn
- Sets the indentation step for ^K, and ^K..
- -linums
- Line numbers are displayed before each line.
- -rdonly
- The file is read only.
- -keymap name
- Use an alternate section of the joerc file for the key
sequence bindings. For example, joe, jstar, rjoe and jupp
support -keymap cua to make ^Z, ^X, ^C and ^V do the same thing as
in contemporary GUI editors.
Editing Tasks¶
Basic Editing¶
When you type characters into the editor, they are normally inserted into the file being edited (or appended to the file if the cursor is at the end of the file). This is the normal operating mode of the editor. If you want to replace some existing text, you have to delete the old text before or after you type in the replacement text. The Backspace key can be used for deleting text: move the cursor to right after the text you want to delete and hit Backspace a number of times.Word wrap and formatting¶
If you type past the right edge of the screen in a C language or PASCAL file, the screen will scroll to the right to follow the cursor. If you type past the right edge of the screen in a normal file (one whose name doesn't end in .c, .h or .p), JOE will automatically wrap the last word onto the next line so that you don't have to hit Return. This is called word-wrap mode. Word-wrap can be turned on or off with the ^T W command. JOE's initialization file is usually set up so that this mode is automatically turned on for all non-program files. See the section below on the joerc file to change this and other defaults.Over-type mode¶
Sometimes it's tiresome to have to delete old text before or after you insert new text. This happens, for example, when you are changing a table and you want to maintain the column position of the right side of the table. When this occurs, you can put the editor in over-type mode with ^T T. When the editor is in this mode, the characters you type in replace existing characters, in the way an idealized typewriter would. Also, Backspace simply moves left instead of deleting the character to the left, when it's not at the end or beginning of a line. Over-type mode is not the natural way of dealing with text electronically, so you should go back to insert-mode as soon as possible by typing ^T T again.Control and Meta characters¶
Each character is represented by a number. For example, the number for 'A' is 65 and the number for '1' is 49. All of the characters which you normally see have numbers in the range of 32 - 126 (this particular arbitrary assignment between characters and numbers is called the ASCII character set). The numbers outside of this range, from 0 to 255, aren't usually displayed, but sometimes have other special meanings. The number 10, for example, is used for the line-breaks. You can enter these special, non-displayed control characters by first hitting ` and then hitting a character in the range @ A B C ... X Y Z [ ^ ] \ _ to get the number 0 - 31, and ? to get 127. For example, if you hit ` J, you'll insert a line-break character, or if you hit ` I, you'll insert a TAB character (which does the same thing the TAB key does). A useful control character to enter is 12 ( ` L), which causes most printers to advance to the top of the page. You'll notice that JOE displays this character as an underlined L. You can enter the characters above 127, the meta characters, by first hitting ^\. This adds 128 to the next (possibly control) character entered. JOE displays characters above 128 in inverse-video. Some foreign languages, which have more letters than English, use the meta characters for the rest of their alphabet. You have to put the editor in ASIS mode (described later) to have these passed untranslated to the terminal.Prompts¶
If you hit TAB at any file name prompt, joe will attempt to complete the name you entered as much as possible. If it couldn't complete the entire name, because there are more than one possible completions, joe beeps. If you hit TAB again, joe list the completions. You can use the arrow keys to move around this directory menu and press RETURN or SPACE to select an item. If you press the first letter of one of the directory entries, it will be selected, or if more than one entry has the same first letter, the cursor will jump between those entries. If you select a subdirectory or .., the directory name is appended to the prompt and the new directory is loaded into the menu. You can hit Backspace to go back to the previous directory.Where am I?¶
Hit ^K SPACE to have JOE report the line number, column number, and byte number on the last line of the screen. The number associated with the character the cursor is on (its ASCII code) is also shown. You can have the line number and/or column number always displayed on the status line by setting placing the appropriate escape sequences in the status line setup strings. Edit the joerc file for details.File operations¶
You can hit ^K D to save the current file (possibly under a different name from what the file was called originally). After the file is saved, you can hit ^K E to edit a different file.Temporarily suspending the editor¶
If you need to temporarily stop the editor and go back to the shell, hit ^K Z. You might want to do this to stop whatever you're editing and answer an e-mail message or read this man page, for example. You have to type fg or exit (you'll be told which when you hit ^K Z) to return to the editor.Searching for text¶
Hit ^K F to have the editor search forwards or backwards for a text fragment ( string) for you. You will be prompted for the text to search for. After you hit Return, you are prompted to enter options. You can just hit Return again to have the editor immediately search forwards for the text, or you can enter one or more of these options:- b
- Search backwards instead of forwards.
- i
- Treat uppercase and lower case letters as the same when
searching. Normally uppercase and lowercase letters are considered to be
different.
- nnn
- (where nnn is a number) If you enter a number, JOE
searches for the Nth occurrence of the text. This is useful for going to
specific places in files structured in some regular manner.
- r
- Replace text. If you enter the r option, then you
will be further prompted for replacement text. Each time the editor finds
the search text, you will be prompted as to whether you want to replace
the found search text with the replacement text. You hit: y to
replace the text and then find the next occurrence, n to not
replace this text, but to then find the next occurrence, l to
replace the text and then stop searching, r to replace all of the
remaining occurrences of the search text in the remainder of the file
without asking for confirmation (subject to the nnn option above),
or ^C to stop searching and replacing.
Regular Expressions¶
A number of special character sequences may be entered as search text:- \*
- This finds zero or more characters. For example, if you
give A\*B as the search text, JOE will try to find an A followed by
any number of characters and then a B.
- \?
- This finds exactly one character. For example, if you give
A\?B as the search text, JOE will find AXB, but not AB or AXXB.
- \^ \$
- These match the beginning and end of a line. For example,
if you give \^test\$, then JOE with find test on a line by
itself.
- \< \>
- These match the beginning and end of a word. For example,
if you give \<\*is\*\>, then joe will find whole words which
have the sub-string is within them.
- \[...]
- This matches any single character which appears within the
brackets. For example, if \[Tt]his is entered as the search string,
then JOE finds both This and this. Ranges of characters can
be entered within the brackets. For example, \[A-Z] finds any
uppercase letter. If the first character given in the brackets is
^, then JOE tries to find any character not given in the the
brackets.
- \c
- This works like \*, but matches a balanced
C-language expression. For example, if you search for malloc(\c),
then JOE will find all function calls to malloc, even if there was
a ) within the parenthesis.
- \+
- This finds zero or more of the character which immediately
follows the \+. For example, if you give \[ ]\+\[ ], where
the characters within the brackets are both SPACE and TAB, then JOE will
find whitespace.
- \\
- Matches a single \.
- \n
- This finds the special end-of-line or line-break character.
- \&
- This gets replaced by the text which matched the search
string. For example, if the search string was \<\*\>, which
matches words, and you give "\&", then joe will put
quote marks around words.
- \0 - \9
- These get replaced with the text which matched the Nth
\*, \?, \+, \c, \+, or \[...] in
the search string.
- \\
- Use this if you need to put a \ in the replacement
string.
- \n
- Use this if you need to put a line-break in the replacement string.
Blocks¶
If you want to move, copy, save or delete a specific section of text, you can do it with highlighted blocks. First, move the cursor to the start of the section of text you want to work on, and press ^K B. Then move the cursor to the character just after the end of the text you want to affect and press ^K K. The text between the ^K B and ^K K should become highlighted. Now you can move your cursor to someplace else in your document and press ^K M to move the highlighted text there. You can press ^K C to make a copy of the highlighted text and insert it to where the cursor is positioned. ^K Y to deletes the highlighted text. ^K W, writes the highlighted text to a file.Indenting program blocks¶
Auto-indent mode toggled with the ^T I command. The joerc is normally set up so that files with names ending with .p, .c or .h have auto-indent mode enabled. When auto-indent mode is enabled and you hit Return, the cursor will be placed in the same column that the first non-SPACE/TAB character was in on the original line.Windows¶
You can edit more than one file at the same time or edit two or more different places of the same file. To do this, hit ^K O, to split the screen into two windows. Use ^K P or ^K N to move the cursor into the top window or the lower window. Use ^K E to edit a new file in one of the windows. A window will go away when you save the file with ^K X or abort the file with ^C. If you abort a file which exists in two windows, one of the window goes away, not the file.Keyboard macros¶
Macros allow you to record a series of keystrokes and replay them with the press of two keys. This is useful to automate repetitive tasks. To start a macro recording, hit ^K [ followed by a number from 0 to 9. The status line will display (Macro n recording...). Now, type in the series of keystrokes that you want to be able to repeat. The commands you type will have their usual effect. Hit ^K ] to stop recording the macro. Hit ^K followed by the number you recorded the macro in to execute one iteration of the key-strokes.Repeat¶
You can use the repeat command, ^K \, to repeat a macro, or any other edit command or even a normal character, a specified number of times. Hit ^K \, type in the number of times you want the command repeated and press Return. The next edit command you now give will be repeated that many times.Rectangle mode¶
Type ^T X to have ^K B and ^K K select rectangular blocks instead of stream-of-text blocks. This mode is useful for moving, copying, deleting or saving columns of text. You can also filter columns of text with the ^K / command- if you want to sort a column, for example. The insert file command, ^K R is also effected.Tag search¶
If you are editing a large C program with many source files, you can use the ctags program to generate a tags file. This file contains a list of program symbols and the files and positions where the symbols are defined. The ^K ; command can be used to lookup a symbol (functions, defined constants, etc.), load the file where the symbol is defined into the current window and position the cursor to where the symbol is defined. ^K ; prompts you for the symbol you want, but uses the symbol the cursor was on as a default. Since ^K ; loads the definition file into the current window, you probably want to split the window first with ^K O, to have both the original file and the definition file loaded.Shell windows¶
Hit ^K ' to run a command shell in one of JOE's windows. When the cursor is at the end of a shell window (use ^K V if it's not), whatever you type is passed to the shell instead of the window. Any output from the shell or from commands executed in the shell is appended to the shell window (the cursor will follow this output if it's at the end of the shell window). This command is useful for recording the results of shell commands- for example the output of make, the result of grepping a set of files for a string, or directory listings from FTP sessions. Besides typeable characters, the keys ^C, Backspace, DEL, Return and ^D are passed to the shell. Type the shell exit command to stop recording shell output. If you press ^C in a shell window, when the cursor is not at the end of the window, the shell is killed.Environment variables¶
For JOE to operate correctly, a number of other environment settings must be correct. The throughput (baud rate) of the connection between the computer and your terminal must be set correctly for JOE to update the screen smoothly and allow typeahead to defer the screen update. Use the stty nnn command to set this. You want to set it as close as possible to actual throughput of the connection. For example, if you are connected via a 1200 baud modem, you want to use this value for stty. If you are connected via 14.4k modem, but the terminal server you are connected to connects to the computer a 9600 baud, you want to set your speed as 9600 baud. The special baud rate of 38400 or extb is used to indicate that you have a very-high speed connection, such as a memory mapped console or an X-window terminal emulator. If you can't use stty to set the actual throughput (perhaps because of a modem communicating with the computer at a different rate than it's communicating over the phone line), you can put a numeric value in the BAUD environment variable instead (use setenv BAUD 9600 for csh or BAUD=9600; export BAUD for sh).Filenames¶
Wherever JOE expects you to enter a file name, whether on the command line or in prompts within the editor, you may also type:- !command
- Read or write data to or from a shell command. For example,
use joe '!ls' to get a copy of your directory listing to edit or
from within the editor use ^K D !mail jhallen@world.std.com to send
the file being edited to me.
- >>filename
- Use this to have JOE append the edited text to the end of
the file "filename."
- filename,START,SIZE
- Use this to access a fixed section of a file or device.
START and SIZE may be entered in decimal (ex.: 123) octal
(ex.: 0777) or hexadecimal (ex.: 0xFF). For example, use joe
/dev/fd0,508,2 to edit bytes 508 and 509 of the first floppy drive in
Linux.
- -
- Use this to get input from the standard input or to write
output to the standard output. For example, you can put joe in a pipe of
commands: quota -v | joe - | mail root, if you want to complain
about your low quota.