Mnemonics

Before looking at some more examples, lets first include the list of mnemonics. This list can be found also in the sources of the file keycomp.c which is on the distribution disk. If you would like to introduce more mnemonics you only have to add them to the list and translate the file again. Be sure though that they are in strict lexicographic order (you can use the sort command (p. [*]) if you are not sure). The rules about the hexadecimal codes are given further on in the text. All mnemonics are taken in a case insensitive way but they must be in capitals in the table.

after_read
A special code for in the left hand side. Used to define action after reading a file.
alt_0 to alt_9
Like the regular commands Alt-number.
alt_a to alt_z
Like the Alt-character commands.
alt_eq
Code for Alt-= to jump to a matching bracket.
alt_fun0 to alt_fun9
For the PC: to terminate a learn sequence or to execute it.
backslash
The backslash character (not to be used as an escape code in the redefinition file.
backspace
blank
clear
Clear the current buffer.
close
Close the current fold.
close_all
Close all folds.
colon
The colon character (avoids problems with the colon that indicates commentary in the redefinition file).
comma
The comma character.
command
A special entry to the command line of stedi. The same redefinition should also contain `endcommand'. All characters in between are seen as a command for the command line, but they won't be entered in the command history, and they won't be shown on the screen.
copy
Copy the current range.
copy_block
Copy the current block.
creturn
A carriage return.
ctrl_0 to ctrl_9
Terminate a learn sequence or execute it.
ctrl_a to ctrl_z
Like the Ctrl-character commands.
ctrl_fun1 to ctrl_fun10
For the PC: Go to the corresponding tag.
ctrl_min
Put the date in the current buffer.
ct_delete
Delete the current line.
ct_down
Move screen up by one line, hold cursor.
ct_home
Go to home position on current screen.
ct_left
Scroll one page to the left.
ct_right
Scroll one page to the right.
ct_up
Move screen down by one line, hold cursor.
cut
Cut/yank current range.
cut_block
Cut/yank current block.
delete
Delete the current character.
deleteline
Delete the current line.
delete_mark
Delete the mark.
down
Move cursor down.
end
Put cursor at the end of the buffer.
endcommand
See the `command' mnemonic above.
enter
The enter key.
escape
The escape key.
exchange
Exchange the mark and the cursor.
flags000 - flags111
Set the flags to the given binary position.
flag1on-flag3on
Turn one flag on.
flag1off-flag3off
Turn one flag off.
fun1 to fun10
The first ten function keys.
fun11 to fun20
The first ten function keys, together with a shift key.
goto_mark
Go to the mark.
help
Same as pressing the help key (F12 on some systems).
home
Put cursor at the beginning of the buffer
insert
Insert a new line.
learn0-learn10
Terminate a learn sequence or execute it.
left
Move the cursor to the left.
linefeed
Generate a linefeed code (has usually the same effect as a carriage return).
mark
Place a mark.
nocode
Dummy code which has no effect. This way a right hand side can be `empty'.
num_0 to num_9
Numeric key pad 0 to 9 (if it can be distinguished (cannot be done on most PC's).
num_enter
The enter key.
on_exit
Special code for actions to be undertaken when the editor is terminated.
open
Open the current fold (if the cursor is on one).
open_all
Open all folds.
page_down
Move the cursor one page down.
page_up
Move the cursor one page up.
paste
Paste the contents of the active yank buffer into the text.
paste_block
Paste the contents of the active yank buffer into the text using the block mode.
plus
The character +.
quit
Leave the editor.
read
Read a file (same as F8).
return
The return key.
right
Move the cursor to the right.
save
Save the contents of the current buffer, using the name of the buffer.
save_quit
Save the contents of the current buffer and leave the editor.
sc_home
Move the cursor to the left bottom position on the screen.
sc_left
Move the cursor to the previous character. See tabs as one character, and go to the previous line if necessary.
sc_right
Move the cursor to the next character. See tabs as one character and go to the next line if necessary.
semicolon
The semicolon character for insertion in the text.
sh_down
Go to the next page.
sh_home
Go to the end of the buffer.
sh_insert
Insert a new line after the current line.
sh_left
Go to the beginning of the current line.
sh_page_down
Move the cursor to the next line but keep its position fixed on the screen (scrolls screen up).
sh_page_up
Move the cursor to the previous line but keep its position fixed on the screen (scrolls screen down).
sh_right
Go to the end of the current line.
sh_up
Go to the previous page.
startup
Special code to define a sequence of keys to be executed when the editor is started. This code will be executed after the files from the command line have been read. This code is not executed in the streamer mode.
tab
The tab character.
tag0 to tag10
Go to the corresponding tag. 0 and 10 are identical.
undo
Undo the last sequence of deletes (or clear buffer).
up
Move the cursor up.
write
Write file. Similar to shift-F8.
yank
Yank/cut the current range.
yank_block
Yank/cut the current block.

The numeric key pad codes cannot be generated easily on some computers, because in the past they were generated by having a special status key and then keys on the regular pad were used together with this status key. This is still the case on the PC. The numeric key codes given by the keyboard processor of the PC mimic the corresponding regular keys.

Keys that have no direct binding in stedi are not mentioned in the above table.

When you are taking a key redefinition file from one type of computer to another type, the right hand sides with their mnemonics should still be valid. It may be that the other computer has a completely different keyboard with entirely different capabilities. Hence it could be necessary to reprogram the left hand sides (usually the lesser amount of work).

In the next example, the left and right arrow keys will be replaced by Ctrl-Shift-left-arrow and Ctrl-Shift-right-arrow respectively and vice versa. The Ctrl-Shift-left/right-arrow keys cause the cursor to move according to the actual characters that are in the text as in some editors, and not according to the screen. Some people may prefer this.

: Example 3 : redefinition of normal keys;

00001002(right-arrow)            = sc_right;
00001003(left-arrow)             = sc_left;
0600100E(Ctrl-Shift-right-arrow) = right;
0600100F(Ctrl-Shift-left-arrow)  = left;

What we see here is not at all dangerous as might be expected. The output of the keyboard processor is not given back to its own input, so there is no danger of loops. Hence you may freely interchange the action of two keys as was done above. The next example is a little more sophisticated (and useful).

: Example 4 : Put editor in wordwrap
              and auto indent mode;

0200101B(left-shift+escape)
    + 00000032 (followed by 2) =
   command a plus  endcommand(autoindent on)
   command w w 7 2 endcommand(wordwrap at 72);
The left hand side consists now of two keys. This means that after you press shift-escape the editor will wait to see what comes next. If this is the character 2 it will generate the given sequence. If it is a character that doesn't occur in any sequence the message `Key not active' is given in the message line. You can also see what is the best way of generating commands that are executed via the command line. The special mnemonics `command' and `endcommand' cause the characters in between to be treated as a command from the command line. This command will not be entered in the history though.