Magma provides a line editor with both Emacs and VI style key bindings. To enable the VI style of key bindings, type
and type
to revert to the Emacs style of key bindings. By default ViMode is false; that is, the Emacs style is in effect. Many key bindings are the same in both Emacs and VI style. This is because some VI users like to be able to use some Emacs keys (like <Ctrl>-P) as well as the VI command keys. Thus key bindings in Emacs which are not used in VI insert mode can be made common to both.
<Ctrl>-KEY means hold down the Control key and press KEY.
Accept the line and print a new line. This works in any mode.
Delete the previous character.
Complete the word which the cursor is on or just after. If the word doesn't have a unique completion, it is first expanded up to the common prefix of all the possible completions. An immediately following Tab key will list all of the possible completions. Currently completion occurs for system functions and procedures, parameters, reserved words, and user identifiers.
Move to the beginning of the line ("alpha" = "beginning").
Move back a character ("back").
Abort the current line and start a new line.
On an empty line, send a EOF character (i.e., exit at the top level of the command interpreter). If at end of line, list the completions. Otherwise, delete the character under the cursor ("delete").
Move to the end of the line ("end").
Move forward a character ("forward").
Same as Backspace.
Same as Tab.
Same as Return.
Delete all characters from the cursor to the end of the line ("kill").
Redraw the line on a new line (helpful if the screen gets wrecked by programs like "write", etc.).
Same as <Return>.
Go forward a line in the history buffer ("next"). If the cursor is not at the beginning of the line, go forward to the first following line which starts with the same string (ignoring spaces iff the ignore spaces option is on --- see SetIgnoreSpaces) as the string consisting of all the characters before the cursor. Also, if <Ctrl>-N is typed initially at a new line and the last line entered was actually a recall of a preceding line, then the next line after that is entered into the current buffer. Thus to repeat a sequence of lines (with minor modifications perhaps to each), then one only needs to go back to the first line with <Ctrl>-P (see below), press <Return>, then successively press <Ctrl>-N followed by <Return> for each line.
Go back a line in the history buffer ("previous"). If the cursor is not at the beginning of the line, go back to the first preceding line which starts with the same string (ignoring spaces iff the ignore spaces option is on --- see SetIgnoreSpaces) as the string consisting of all the characters before the cursor. For example, typing at a new line x:= and then <Ctrl>-P will go back to the last line which assigned x (if a line begins with, say, x :=, it will also be taken).
Clear the whole of the current line.
Insert the following character literally.
Delete the previous word.
Same as <Ctrl>-U.
Insert the contents of the yank-buffer before the character under the cursor.
Stop Magma.
Undo the last change.
Immediately quit Magma.
On most systems the arrow keys also have the obvious meaning.
<Meta>-KEY means press the Meta key and then KEY. (At the moment, the Meta key is only the Esc key.)
Move back a word ("Back").
Move forward a word ("Forward").
In the VI mode, the line editor can also be in two modes: the insert mode and the command mode. When in the insert mode, any non-control character is inserted at the current cursor position. The command mode is then entered by typing the Esc key. In the command mode, various commands are given a range giving the extent to which they are performed. The following ranges are available:
Move to the beginning of the line.
Move to the end of the line.
Move to the first non-space character of the line.
Move to the matching bracket. (Bracket characters are (, ), [, ], {, }, <, and >.)
Move to the next character. (See `F', `f', `T', and `t'.)
Move to the previous character. (See `F', `f', `T', and `t'.)
Move back a space-separated word ("Back").
Move back a word ("back").
Move forward to the end of the space-separated word ("End").
Move forward to the end of the word ("end").
Move back to the first occurrence of <char>.
Move forward to the first occurrence of <char>.
Move back a character (<Ctrl>-H = Backspace).
Move back a character (<Ctrl>-L = forward on some keyboards).
Move back to just after the first occurrence of <char>.
Move forward to just before the first occurrence of <char>.
Move forward a space-separated word ("Word").
Move forward a word ("word").
Any range may be preceded by a number to multiply to indicate how many times the operation is done. The VI-mode also provides the yank-buffer, which contains characters which are deleted or "yanked" -- see below.
The following keys are also available in command mode:
Move to the end of the line and change to insert mode ("Append").
Move forward a character (if not already at the end of the line) and change to insert mode ("append").
Delete all the characters to the end of line and change to insert mode ("Change").
Delete all the characters to the specified range and change to insert mode ("change").
Delete all the characters to the end of line ("Delete").
Delete all the characters to the specified range ("delete").
Move to the first non-space character in the line and change to insert mode ("Insert").
Change to insert mode ("insert").
Go forward a line in the history buffer (same as <Ctrl>-N).
Go back a line in the history buffer (same as <Ctrl>-P).
Insert the contents of the yank-buffer before the character under the cursor.
Insert the contents of the yank-buffer before the character after the cursor.
Enter over-type mode: typed characters replace the old characters under the cursor without insertion. Pressing Esc returns to the command mode.
Replace the character the cursor is over with <char>.
Delete the whole line and change to insert mode ("Substitute").
Delete the current character and change to insert mode ("substitute").
Undo the last change.
Delete the character to the left of the cursor.
Delete the character under the cursor.
"Yank" the whole line - i.e., copy the whole line into the yank-buffer ("Yank").
Copy all characters from the cursor to the specified range into the yank-buffer ("yank").