Skip to content

Plugin.addCommand method

Plugin › addCommand

Official

Register a command globally. Registered commands will be available from the https://help.obsidian.md/Plugins/Command+palette Command palette. The command id and name will be automatically prefixed with this plugin's id and name.

Signature:

addCommand(command: Command): Command

Parameters:

ParameterTypeDescription
commandCommandThe command.

Returns: Command — The command, with its ID and name prefixed.

Since: 0.9.7

Example:

plugin.addCommand({
id: 'foo',
name: 'Foo',
});