Inline editing in the Korn shell or POSIX shell

Normally, you type each command line from a terminal device and follow it by a newline character (RETURN or LINE FEED). When you activate the emacs, gmacs, or vi inline editing option, you can edit the command line.

The following commands enter edit modes:

Item Description
set -o emacs Enters emacs editing mode and initiates an emacs-style inline editor.
set -o gmacs Enters emacs editing mode and initiates a gmacs-style inline editor.
set -o vi Enters vi editing mode and initiates a vi-style inline editor.

An editing option is automatically selected each time the VISUAL or EDITOR variable is assigned a value that ends in any of these option names.

Note: To use the editing features, your terminal must accept RETURN as a carriage return without line feed. A space must overwrite the current character on the screen.

Each editing mode opens a window at the current line. The window width is the value of the COLUMNS variable if it is defined; otherwise, the width is 80 character spaces. If the line is longer than the window width minus two, the system notifies you by displaying a mark at the end of the window. As the cursor moves and reaches the window boundaries, the window is centered about the cursor. The marks displayed are as follows:

Item Description
> Indicates that the line extends on the right side of the window.
< Indicates that the line extends on the left side of the window.
* Indicates that the line extends on both sides of the window.

The search commands in each edit mode provide access to the Korn shell history file. Only strings are matched. If the leading character in the string is a carat (^), the match must begin at the first character in the line.