Module modules.scite.keys

Manages key commands in SciTE. Key commands are defined in a separate key_commands.lua file that is located in the same directory or package.path. There are several option variables used: PLATFORM: OS platform (linux or windows) SCOPES_ENABLED: Flag indicating whether scopes/styles can be used for key commands. CTRL: The string representing the Control key. SHIFT: The string representing the Shift key. ALT: The string representing the Alt key. ADD: The string representing used to join together a sequence of Control, Shift, or Alt modifier keys. KEYCHAIN_PROP: The SciTE property that will be updated each time the keychain is modified.

Functions

_G.OnKey (code, shift, control, alt) SciTE OnKey Lua extension function.
clear_key_sequence () Clears the current key sequence.
show_completions () Determines the possible completions for the current key sequence and prints them out.
try_get_cmd (active_table) [Local function] Helper function to get commands with the current keychain.
try_get_cmd1 (key_seq, lexer, scope) [Local function] Tries to get a key command based on the lexer and current scope.
try_get_cmd2 (key_seq, lexer) [Local function] Tries to get a key command based on the lexer.
try_get_cmd3 (key_seq) [Local function] Tries to get a global key command.

Tables

KEYSYMS [Local table] Lookup table for key values higher than 255.
keychain [Local table] The current key sequence.
keys Global container that holds all key commands.


Functions

_G.OnKey (code, shift, control, alt)
SciTE OnKey Lua extension function. It is called every time a key is pressed and determines which commands to execute or which new key in a chain to enter based on the current key sequence, lexer, and scope.

Parameters

  • code:
  • shift:
  • control:
  • alt:

Return value:

OnKey returns what the commands it executes return. If nothing is returned, OnKey returns true by default. A true return value will tell SciTE not to handle the key afterwords.
clear_key_sequence ()
Clears the current key sequence.
show_completions ()
Determines the possible completions for the current key sequence and prints them out. (Only prints key combinations, not command names.)
try_get_cmd (active_table)
[Local function] Helper function to get commands with the current keychain. If the current item in the keychain is part of a chain, throw an error value of -1. This way, pcall will return false and -1, where the -1 can easily and efficiently be checked rather than using a string error message.

Parameters

  • active_table:
try_get_cmd1 (key_seq, lexer, scope)
[Local function] Tries to get a key command based on the lexer and current scope.

Parameters

  • key_seq:
  • lexer:
  • scope:
try_get_cmd2 (key_seq, lexer)
[Local function] Tries to get a key command based on the lexer.

Parameters

  • key_seq:
  • lexer:
try_get_cmd3 (key_seq)
[Local function] Tries to get a global key command.

Parameters

  • key_seq:

Tables

KEYSYMS
[Local table] Lookup table for key values higher than 255. If a key value given to OnKey is higher than 255, this table is used to return a string representation of the key if it exists.
keychain
[Local table] The current key sequence.
keys
Global container that holds all key commands.

Valid XHTML 1.0!