6.8 Line Editing

GAP allows one 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 ctrl key, and, while still holding the ctrl 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 ctrl-key and escape keys by esc-key. The case of key does not matter, i.e., ctrl-A and ctrl-a are equivalent.

Typing ctrl-key or esc-key for characters not mentioned below always inserts ctrl-key resp. esc-key at the current cursor position.

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

ctrl-A move the cursor to the beginning of the line.

esc-B move the cursor to the beginning of the previous word.

ctrl-B move the cursor backward one character.

ctrl-F move the cursor forward one character.

esc-F move the cursor to the end of the next word.

ctrl-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 ctrl-Y.

ctrl-H or del delete the character left of the cursor.

ctrl-D delete the character under the cursor.

ctrl-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.

ctrl-X kill entire input line, and discard all pending input.

ctrl-Y insert (yank) a just killed text.

The next commands allow you to change the input.

ctrl-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 ctrl-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.

ctrl-L insert last input line before current character.

ctrl-P redisplay the last input line, another ctrl-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.

ctrl-N Like ctrl-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.

ctrl-O accepts this line and perform a ctrl-N.

Finally there are a few miscellaneous commands.

ctrl-V enter next character literally, i.e., enter it even if it is one of the control keys.

ctrl-U execute the next line editing command 4 times.

esc-num execute the next line editing command num times.

esc-ctrl-L redisplay input line.

The four arrow keys (cursor keys) can be used instead of ctrl-B, ctrl-F, ctrl-P, and ctrl-N, respectively.

[Top] [Previous] [Up] [Next] [Index]

GAP 4 manual
February 2000