HP-UX Reference (11i v2 03/08) - 1 User Commands N-Z (vol 2)
s
sh-posix(1) sh-posix(1)
emacs/gmacs Editing Mode
This mode is invoked by either the
emacs or gmacs option. The sole difference is how they handle
Control-T.
To edit, the user moves the cursor to the point needing correction and inserts or deletes characters or
words. All editing commands are control characters or escape sequences. The notation for control char-
acters is caret (
ˆ) followed by a character. For example,
ˆF is the notation for Control-F. This is entered
by holding down the Ctrl (control) key and pressing
f. The shift key is not pressed. The notation ˆ?
indicates the delete (DEL) key.
The notation for escape sequences is
M- followed by a character. For example,
M-f (pronounced meta f)
is entered by pressing the escape key (Esc) followed by pressing
f. M-F is the notation for escape fol-
lowed by shift (capital)
F.
All edit commands operate from any place on the line (not only at the beginning). Neither the return (
ˆM)
nor the newline (
ˆJ) key is entered after edit commands, except when noted.
^F Move cursor forward (right) one character.
M-f Move cursor forward one word. (The editor’s idea of a word is a string of characters
consisting of only letters, digits and underscores.)
^B Move cursor backward (left) one character.
M-b Move cursor backward one word.
^A Move cursor to start of line.
^E Move cursor to end of line.
^]char Move cursor forward to character char on current line.
M-ˆ]char Move cursor backward to character char on current line.
^XˆX Interchange the cursor and mark.
erase Delete previous character. The erase character is user-definable with the stty
command; it is usually set to ˆH. The system default is #.
^D Delete current character.
eof Terminate the shell if the current line is null. The eof character is user-definable
with the
stty command; it is usually set to ˆD. The system default is ˆD
.
M-d Delete current word.
M-ˆH Delete previous word (meta-backspace).
M-h Delete previous word.
M-ˆ? Delete previous word (meta-delete). If your interrupt character is
ˆ? (DEL, the
default), this command will not work.
^T In emacs mode, transpose current character with next character. In gmacs mode,
transpose two previous characters.
^C Capitalize current character.
M-c Capitalize current word.
M-l Change the current word to lowercase.
^K Delete from the cursor to the end of the line. If preceded by a numerical parameter
whose value is less that the current cursor position, then delete from the given posi-
tion up to the cursor. If preceded by a numerical parameter whose value is greater
than the current cursor position, then delete from the cursor up to the given posi-
tion.
^W Kill from the cursor to the mark.
M-p Push the region from the cursor to the mark on the stack.
kill Kill the entire current line. If two kill characters are entered in succession, all sub-
sequent consecutive kill characters cause a line feed (useful when using paper ter-
minals). The kill character is user-definable with the stty command; it is usually
set to ˆX or ˆU. The system default is @.
^Y Restore last item removed from line (yank item back to the line).
^L Line feed and print current line.
^@ Set mark (null character).
M- Set mark (meta-space).
^J Execute the current line (newline).
^M Execute the current line (return).
^P Fetch previous command. Each time ˆP is entered, the previous command in the
history list is accessed.
^N Fetch next command. Each time ˆN is entered the next command in the history list
is accessed.
Section 1−−820 Hewlett-Packard Company − 22 − HP-UX 11i Version 2: August 2003