Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

uji.command

These functions manage the slash commands that your config and plugins add. Slash commands lists the built-in ones.

uji.command.add(name, spec)

Registers /name, or replaces the Lua command with the same name. spec is a function, or a table with these fields.

FieldTypeRequiredMeaning
handlerfunctionyesRuns the command. It receives the text typed after the name.
descstringnoThe description in the suggestion list.
forcebooleannoWith true, replaces a built-in command with the same name.

Raises an error when spec is neither a function nor a table with a handler.

uji.command.add("standup", {
  desc = "summarise yesterday's commits",
  handler = function(args)
    uji.session.submit("Summarise the commits since yesterday. " .. args)
  end,
})

uji.command.remove(name)

Removes a Lua command and returns true if it existed.

uji.command.remove("standup")

uji.command.list()

Returns the names of the Lua commands in alphabetical order. Built-in commands are not in the list.

local names = uji.command.list()