This package contains commands made accessible to frontends and plugins. They come in three flavours: ApplicationCommand
s, WindowCommand
s, and TextCommand
s.
The goal for release 1.0 is to implement all of the commands exposed by Sublime Text 3. See the commands label for outstanding commands to be implemented.
A command is a type implementing one of the command interfaces.
type (
DoSomething struct {
backend.DefaultCommand
}
)
Each command has a Run
method which is executed when the command is invoked.
func (c *DoSomething) Run(v *backend.View, e *backend.Edit) error {
// Do something!
}
Commands need to be registered with the backend via the init
function before it can be executed by plugins.
func init() {
register([]backend.Command{
&DoSomething{},
})
}
If you are interested in implementing a command, see the Implementing commands wiki page.
- Lime's command interface API documentation
- Sublime Text 3's unofficial (and open source!) command documentation