719 B
719 B
APIs related to editor commands
command.define(commandDef)
Registers a command.
Available keys:
name
: Name of the commandrun
: Callback functioncontexts
: AST node context in which this command should be availablepriority
: Command priority (how high it appears in the list)key
: Windows/Linux key binding (and mac, if not separately defined)mac
: Mac-specific key bindinghide
: Hide this command from the Command PaletterequireMode
:rw
orro
— only enable this command in a particular mode (read-write, or read-only)
Example:
command.define {
name = "My custom command",
run = function()
editor.flashNotification "Triggered my custom command"
end
}