APIs to create Slash Commands. For simple cases it is recommended to use Slash Template instead.

slashcommand.define(spec)

Define a custom slash command.

Supported keys in the spec:
  • name: name of the command
  • description: Description of the command
  • run: The callback function that will be invoked once the command is run.


Example:
slashcommand.define {
  name = "hello-world",
  run = function()
editor.insertAtCursor("Hello |^| world!", false, true)
  end
}