action Parameter

Assigns a command to a logical key.

Scope: File

Syntax

query action.[prefix.]KeyName 
set action.[prefix.]KeyName [Command] 

Options

Command 
Command which may include the mult command. If Command is omitted, the key is set to its default action, which is to return its own value.
prefix 
If this option is specified, the key is active only when the cursor is in the prefix area.
KeyName 
Your operating system may reserve certain function keys or key combinations, such as F1, for special purposes. With these exceptions, permitted values for KeyName are:
nnn 
A decimal-based ASCII character code, where n is a digit of value 0 to 9, inclusive. For example, character code 065 = A.
xnn 
xnnn 
A hexadecimal-based ASCII character code, where n is a digit of value 0 to 9, inclusive, or an alphabetic character of value A to F or a to f, inclusive. For example, character code x41 = A.
any letter key 
An alphabetic character of value A to Z or a to z, inclusive.
c-a to c-z 
Ctrl+letter keys
c-0 to c-9 
Ctrl+number keys. (The number keys on the numeric keypad are excluded.)
a-a to a-z 
Alt+letter keys
a-0 to a-9 
Alt+number keys. (The number keys on the numeric keypad are excluded.)
f1 to f12 
Function keys
s-f1 to s-f12 
Shift+Function keys
c-f1 to c-f12 
Ctrl+Function keys
a-f1 to a-f12 
Alt+Function keys
buttonNdouble 
A double click on button N (N = 1, 2, or 3; although only 1 and 2 will be usable on a two-button mouse.)
buttonNdown 
A single click on button N
buttonNdrag 
Drag mouse with button N down
a named key 
The following key names can be used, either alone or in combination with the Alt or Ctrl keys:
Backspace
Tab
Backtab
Enter
Esc
PadEnter

The following key names can be used, either alone or in combination with the Alt, Ctrl, or Shift keys:

PgUp
PgDn
End
Home
Left
Up
Right
Down
 
Ins
Del
 

Description

The action parameter assigns a command to a logical key for the current file only. When the assigned key is pressed, the command is carried out, provided the actions parameter is on. A multiple command can be attached to a key using the mult command.

This parameter can be used to override previously defined accelerators. If the accelerator was advertised on a menu, it would now be incorrect. To change the accelerators displayed for a menu item, use the set actionbar command.

Note: The case of the key assigned to an action is ignored when used in combination with the Alt or Ctrl keys.

Examples

  1. To assign the addition of eight lines to a key sequence (Alt+8), type:
    set action.a-8 add 8 

    Pressing Alt+8 now adds eight lines to the file.

  2. To make the F7 key move the text up by the number of lines that can be displayed in the window, type:
    set action.f7 scroll screen up 
  3. To enable a key sequence (Ctrl+w) to process multiple commands sequentially, for example, to mark a word and then delete it, type:
    set action.c-w ;block set clear word ;block delete 

    The first ; is a synonym for the mult command. Actions assigned to a key work much like commands typed on the command line; synonyms are processed; macros and external commands can be used.

  4. To force a macro to be processed in preference to a built-in command, type:
    set action.a-m macro block 

    If the word macro is omitted, the Alt+m key issues the built-in block command. Adding the word macro ensures that the Editor searches instead for a macro named block.lx.

  5. To assign a function to the action of dragging the mouse while a button is pressed, type:
    set action.button1drag ;primitive setcursor ;block mark character 

    This dynamically marks the block. The first command, primitive setcursor, makes the Editor move the cursor to the position of the mouse pointer. The second command makes the Editor extend (or shrink) the current block to include the character at the cursor position.

API Return Codes

-1 
The number specified was not a positive integer. Issue the command again using a valid positive number.
-2 
The option specified with the parameter was not valid. Check the syntax requirements for the parameter and try the set or query command again.

actionlist Parameter
accelerator Parameter
actions Parameter
prefixshow Parameter
List of Primitive Functions