emacs editing mode

The emacs editing mode is entered when you enable either the emacs or gmacs option. The only difference between these two modes is the way each handles the Ctrl-T edit command.

To edit, move the cursor to the point needing correction and insert or delete characters or words, as needed. All of the editing commands are control characters or escape sequences.

Edit commands operate from any place on a line (not only at the beginning). Do not press the Enter key or line-feed (Down Arrow) key after edit commands, except as noted.


Item Description
Ctrl-F Moves the cursor forward (right) one character.
Esc-F Moves the cursor forward one word (a string of characters consisting of only letters, digits, and underscores).
Ctrl-B Moves the cursor backward (left) one character.
Esc-B Moves the cursor backward one word.
Ctrl-A Moves the cursor to the beginning of the line.
Ctrl-E Moves the cursor to the end of the line.
Ctrl-] c Moves the cursor forward on the current line to the indicated character.
Esc-Ctrl-] c Moves the cursor backward on the current line to the indicated character.
Ctrl-X Ctrl-X Interchanges the cursor and the mark.
ERASE Deletes the previous character. (User-defined erase character as defined by the stty command, usually the Ctrl-H key sequence.)
Ctrl-D Deletes the current character.
Esc-D Deletes the current word.
Esc-Backspace Deletes the previous word.
Esc-H Deletes the previous word.
Esc-Delete Deletes the previous word. If your interrupt character is the Delete key, this command does not work.
Ctrl-T Transposes the current character with the next character in emacs mode. Transposes the two previous characters in gmacs mode.
Ctrl-C Capitalizes the current character.
Esc-C Capitalizes the current word.
Esc-L Changes the current word to lowercase.
Ctrl-K Deletes from the cursor to the end of the line. If preceded by a numeric parameter whose value is less than the current cursor position, this editing command deletes from the given position up to the cursor. If preceded by a numeric parameter whose value is greater than the current cursor position, this editing command deletes from the cursor up to the given cursor position.
Ctrl-W Deletes from the cursor to the mark.
Esc-P Pushes the region from the cursor to the mark on the stack.
KILL User-defined kill character as defined by the stty command, usually the Ctrl-G key sequence or @. Kills the entire current line. If two kill characters are entered in succession, all subsequent kill characters cause a line feed (useful when using paper terminals).
Ctrl-Y Restores the last item removed from the line. (Yanks the item back to the line.)
Ctrl-L Line feeds and prints the current line.
Ctrl-@ (Null character) Sets a mark.
Esc-space Sets a mark.
Ctrl-J (New line) Executes the current line.
Ctrl-M (Return) Executes the current line.
EOF Processes the end-of-file character, normally the Ctrl-D key sequence, as an end-of-file only if the current line is null.
Ctrl-P Fetches the previous command. Each time the Ctrl-P key sequence is entered, the previous command back in time is accessed. Moves back one line when not on the first line of a multiple-line command.
Esc-< Fetches the least recent (oldest) history line.
Esc-> Fetches the most recent (youngest) history line.
Ctrl-N Fetches the next command line. Each time the Ctrl-N key sequence is entered, the next command line forward in time is accessed.
Ctrl-R String Reverses search history for a previous command line containing the string specified by the String parameter. If a value of 0 is given, the search is forward. The specified string is terminated by an Enter or newline character. If the string is preceded by a carat (^), the matched line must begin with the String parameter. If the String parameter is omitted, then the next command line containing the most recent String parameter is accessed. In this case, a value of 0 reverses the direction of the search.
Ctrl-O (Operate) Executes the current line and fetches the next line relative to the current line from the history file.
Esc Digits (Escape) Defines the numeric parameter. The digits are taken as a parameter to the next command. The commands that accept a parameter are Ctrl-F, Ctrl-B, ERASE, Ctrl-C, Ctrl-D, Ctrl-K, Ctrl-R, Ctrl-P, Ctrl-N, Ctrl-], Esc-., Esc-Ctrl-], Esc-_, Esc-B, Esc-C, Esc-D, Esc-F, Esc-H, Esc-L, and Esc-Ctrl-H.
Esc Letter (Soft-key) Searches the alias list for an alias named _Letter. If an alias of this name is defined, its value is placed into the input queue. The Letter parameter must not specify one of the escape functions.
Esc-[ Letter (Soft-key) Searches the alias list for an alias named double underscore Letter (__Letter). If an alias of this name is defined, its value is placed into the input queue. This command can be used to program function keys on many terminals.
Esc-. Inserts on the line the last word of the previous command. If preceded by a numeric parameter, the value of this parameter determines which word to insert rather than the last word.
Esc-_ Same as the Esc-. key sequence.
Esc-* Attempts file name substitution on the current word. An asterisk (*) is appended if the word does not match any file or contain any special pattern characters.
Esc-Esc File name completion. Replaces the current word with the longest common prefix of all file names that match the current word with an asterisk appended. If the match is unique, a slash (/) is appended if the file is a directory and a space is appended if the file is not a directory.
Esc-= Lists the files that match the current word pattern as if an asterisk (*) were appended.
Ctrl-U Multiplies the parameter of the next command by 4.
\ Escapes the next character. Editing characters and the ERASE, KILL and INTERRUPT (normally the Delete key) characters can be entered in a command line or in a search string if preceded by a backslash (\). The backslash removes the next character's editing features, if any.
Ctrl-V Displays the version of the shell.
Esc-# Inserts a pound sign (#) at the beginning of the line and then executes the line. This causes a comment to be inserted in the history file.