joe (1) Linux Manual Page
Name
joe – Joe’s Own Editor
Syntax
joe [global-options] [ [local-options] filename ]…
jstar [global-options] [ [local-options] filename ]…
jmacs [global-options] [ [local-options] filename ]…
rjoe [global-options] [ [local-options] filename ]…
jpico [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.
JOE also emulates several other editors. JSTAR is a close imitation of WordStar with many "JOE" extensions. JPICO is a close imitation of the Pine mailing system’s PICO editor, but with many extensions and improvements. JMACS is a GNU-EMACS imitation. RJOE is a restricted version of JOE, which allows you to edit only the files specified on the command line.
Although JOE is actually five different editors, it still requires only one executable, but one with five different names. The name of the editor with an "rc" appended gives the name of JOE’s initialization file, which determines the personality of the editor.
JOE is free software; you can distribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. I have no plans for turning JOE into a commercial or share-ware product. JOE is available over the Internet from www.sourceforge.net/projects/joe-editor.
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.
Once you are in the editor, you can type in text and use special control-character sequences to perform other editing tasks. To find out what the control-character sequences are, read the rest of this man page or type ^K H for help in the editor.
Now for some obscure computer-lore:
The ^ means that you hold down the Control key while pressing the following key (the same way the Shift key works for uppercase letters). A number of control-key sequences are duplicated on other keys, so that you don’t need to press the control key: ESC will work in place of ^[, Del will work in place of ^?, Backspace will work in place of ^H, Tab will work in place of ^I, Return or Enter will work in place of ^M and Linefeed will work in place of ^J. Some keyboards may give you trouble with some control keys. ^_, ^^ and ^@ can usually be entered without pressing shift (I.E., try ^-, ^6 and ^2). Other keyboards may reassign these to other keys. Try: ^., ^, and ^/. ^SPACE can usually be used in place of ^@. ^\ and ^] are interpreted by many communication programs, including telnet and kermit. Usually you just hit the key twice to get it to pass through the communication program.
Once you have typed ^K H, the first help window appears at the top of the screen. You can continue to enter and edit text while the help window is on. To page through other topics, hit ^[, and ^[. (that is, ESC , and ESC .). Use ^K H to dismiss the help window.
You can customize the keyboard layout, the help screens and a number of behavior defaults by copying JOE’s initialization file (usually /etc/joe/joerc) to .joerc in your home directory and then by modifying it. See the section joerc below.
To have JOE used as your default editor for e-mail and News, you need to set the EDITOR and VISUAL environment variables in your shell initialization file (.cshrc or .profile) to refer to JOE (joe usually resides as /usr/bin/joe).
There are a number of other obscure invocation parameters which may have to be set, particularly if your terminal screen is not updating as you think it should. See the section Environment variables below.
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.
Each of these options may be specified in the joerc file as well. In addition, the NOXON, BAUD, LINES, COLUMNS and DOPADDING options may be specified with environment variables.
The JOETERM environment variable may be set to override the regular TERM environment variable for specifying your terminal type.
The following options may be specified before each filename on the command line:
- +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.
- -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.
These options can also be specified in the joerc file. They can be set depending on the file-name extension. Programs (.c, .h or .p extension) usually have autoindent enabled. Wordwrap is enabled on other files, but rc files have it disabled.
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.
Hit the Enter or Return key to insert a line-break. For example, if the cursor was in the middle of a line and you hit Return, the line would be split into two lines with the cursor appearing at the beginning of the second line. Hit Backspace at the beginning of a line to eliminate a line-break.
Use the arrow keys to move around the file. If your keyboard doesn’t have arrow keys (or if they don’t work for some reason), use ^F to move forwards (right), ^B to move backwards (left), ^P to move to the previous line (up), and ^N to move to the next line (down). The right and left arrow keys simply move forwards or backwards one character at a time through the text: if you’re at the beginning of a line and you press left-arrow, you will end up at the end of the previous line. The up and down arrow keys move forwards and backwards by enough characters so that the cursor appears in the same column that it was in on the original line.
If you want to indent the text you enter, you can use the TAB key. This inserts a special control character which makes the characters which follow it begin at the next TAB STOP. TAB STOPS normally occur every 8 columns, but this can be changed with the ^T D command. PASCAL and C programmers often set TAB STOPS on every 4 columns.
If for some reason your terminal screen gets messed up (for example, if you receive a mail notice from biff), you can have the editor refresh the screen by hitting ^R.
There are many other keys for deleting text and moving around the file. For example, hit ^D to delete the character the cursor is on instead of deleting backwards like Backspace. ^D will also delete a line-break if the cursor is at the end of a line. Type ^Y to delete the entire line the cursor is on or ^J to delete just from the cursor to the end of the line.
Hit ^A to move the cursor to the beginning of the line it’s on. Hit ^E to move the cursor to the end of the line. Hit ^U or ^V for scrolling the cursor up or down 1/2 a screen’s worth. "Scrolling" means that the text on the screen moves, but the cursor stays at the same place relative to the screen. Hit ^K U or ^K V to move the cursor to the beginning or the end of the file. Look at the help screens in the editor to find even more delete and movement commands.
If you make a mistake, you can hit ^_ to "undo" it. On most keyboards you hit just ^- to get ^_, but on some you might have to hold both the Shift and Control keys down at the same time to get it. If you "undo" too much, you can "redo" the changes back into existence by hitting ^^ (type this with just ^6 on most keyboards).
If you were editing in one place within the file, and you then temporarily had to look or edit some other place within the file, you can get back to the original place by hitting ^K –. This command actually returns you to the last place you made a change in the file. You can step through a history of places with ^K – and ^K =, in the same way you can step through the history of changes with the "undo" and "redo" commands.
When you are done editing the file, hit ^K X to exit the editor. You will be prompted for a file name if you hadn’t already named the file you were editing.
When you edit a file, you actually edit only a copy of the file. So if you decide that you don’t want the changes you made to a file during a particular edit session, you can hit ^C to exit the editor without saving them.
If you edit a file and save the changes, a "backup" copy of that file is created in the current directory, with a ~ appended to the name, which contains the original version of the file.
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.
Aside for Word-wrap mode, JOE does not automatically keep paragraphs formatted like some word-processors. Instead, if you need a paragraph to be reformatted, hit ^K J. This command "fills in" the paragraph that the cursor is in, fitting as many words in a line as is possible. A paragraph, in this case, is a block of text separated above and below by a blank line.
The margins which JOE uses for paragraph formatting and word-wrap can be set with the ^T L and ^T R commands. If the left margin is set to a value other than 1, then when you start typing at the beginning of a line, the cursor will immediately jump to the left margin.
If you want to center a line within the margins, use the ^K A command.
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.
If you need to insert while you’re in over-type mode, hit ^@. This inserts a single SPACE into the text.
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.
Most prompts record a history of the responses you give them. You can hit up and down arrow to step through these histories.
Prompts are actually single line windows with no status line, so you can use any editing command that you normally use on text within the prompts. The prompt history is actually just other lines of the same "prompt file". Thus you can can search backwards though the prompt history with the normal ^K F command if you want.
Since prompts are windows, you can also switch out of them with ^K P and ^K N.
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.
If you want to save only a selected section of the file, see the section on Blocks below.
If you want to include another file in the file you’re editing, use ^K R to insert it.
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:
bis 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.- 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
roption, 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:- Replace text. If you enter the r
yto replace the text and then find the next occurrence,nto not replace this text, but to then find the next occurrence,rto replace all of the remaining occurrences of the search text in the remainder of the file without asking for confirmation (subject to thennnoption above), or^Cto stop searching and replacing.
You can hit ^L to repeat the previous search.
Regular Expressions
A number of special character sequences may be entered as search text:
\*as the search text, JOE will try to find an A followed by any number of characters and then a B.- This finds zero or more characters. For example, if you give A\*B
\?as the search text, JOE will find AXB, but not AB or AXXB.- This finds exactly one character. For example, if you give A\?B
\^, then JOE with find\$ - These match the beginning and end of a line. For example, if you give \^test\$
teston a line by itself.\<, then joe will find whole words which have the sub-string\> - These match the beginning and end of a word. For example, if you give \<\*is\*\>
iswithin them.\[…]is entered as the search string, then JOE finds both- This matches any single character which appears within the brackets. For example, if \[Tt]his
Thisandthis. 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.
