3.4 Line Editing

GAP allows you to edit the current input line with a number of editing commands. Those commands are accessible either as control keys or as escape keys. You enter a control key by pressing the ctr key, and, while still holding the ctr key down, hitting another key key. You enter an escape key by hitting esc and then hitting another key key. Below we denote control keys by ctr-key and escape keys by esc-key. The case of key does not matter, i.e., ctr-A and ctr-a are equivalent.

Characters not mentioned below always insert themselves at the current cursor position.

The first few commands allow you to move the cursor on the current line.

ctr-A move the cursor to the beginning of the line.
esc-B move the cursor to the beginning of the previous word.
ctr-B move the cursor backward one character.
ctr-F move the cursor forward one character.
esc-F move the cursor to the end of the next word.
ctr-E move the cursor to the end of the line.

The next commands delete or kill text. The last killed text can be reinserted, possibly at a different position with the yank command.

ctr-H or del delete the character left of the cursor.
ctr-D delete the character under the cursor.
ctr-K kill up to the end of the line.
esc-D kill forward to the end of the next word.
esc-del kill backward to the beginning of the last word.
ctr-X kill entire input line, and discard all pending input.
ctr-Y insert (yank) a just killed text.

The next commands allow you to change the input.

ctr-T exchange (twiddle) current and previous character.
esc-U uppercase next word.
esc-L lowercase next word.
esc-C capitalize next word.

The tab character, which is in fact the control key ctr-I, looks at the characters before the cursor, interprets them as the beginning of an identifier and tries to complete this identifier. If there is more than one possible completion, it completes to the longest common prefix of all those completions. If the characters to the left of the cursor are already the longest common prefix of all completions hitting tab a second time will display all possible completions.

tab complete the identifier before the cursor.

The next commands allow you to fetch previous lines, e.g., to correct typos, etc. This history is limited to about 8000 characters.

ctr-L insert last input line before current character.
ctr-P redisplay the last input line, another ctr-P will redisplay the line before that, etc. If the cursor is not in the first column only the lines starting with the string to the left of the cursor are taken.
ctr-N Like ctr-P but goes the other way round through the history.
esc-< goes to the beginning of the history.
esc- goes to the end of the history.
ctr-O accepts this line and perform a ctr-N.

Finally there are a few miscellaneous commands.

ctr-V enter next character literally, i.e., enter it even if it is one of the control keys.
ctr-U execute the next command 4 times.
esc-num execute the next command num times.
esc-ctr-L repaint input line.

Previous Up Top Next
Index

GAP 3.4.4
April 1997