https://github.com/limetext/commands
LimeText commands
https://github.com/limetext/commands
Last synced: about 1 year ago
JSON representation
LimeText commands
- Host: GitHub
- URL: https://github.com/limetext/commands
- Owner: limetext
- Created: 2016-04-14T18:05:58.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2020-03-15T18:21:50.000Z (about 6 years ago)
- Last Synced: 2025-03-20T18:08:14.296Z (about 1 year ago)
- Language: Go
- Homepage:
- Size: 121 KB
- Stars: 7
- Watchers: 9
- Forks: 8
- Open Issues: 53
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# commands
[](https://travis-ci.org/limetext/commands)
[](https://coveralls.io/r/limetext/commands?branch=master)
[](https://goreportcard.com/report/github.com/limetext/commands)
[](https://godoc.org/github.com/limetext/commands)
This package contains commands made accessible to frontends and plugins. They come in three flavours: [`ApplicationCommand`](https://godoc.org/github.com/limetext/backend#ApplicationCommand)s, [`WindowCommand`](https://godoc.org/github.com/limetext/backend#WindowCommand)s, and [`TextCommand`](https://godoc.org/github.com/limetext/backend#TextCommand)s.
# Goals
The goal for release 1.0 is to implement all of the commands exposed by Sublime Text 3. See the [commands label](https://github.com/limetext/commands/issues?q=is%3Aopen+is%3Aissue+label%3Acommand) for outstanding commands to be implemented.
## Brief Overview of Commands
A command is a type implementing one of the command interfaces.
```go
type (
DoSomething struct {
backend.DefaultCommand
}
)
```
Each command has a `Run` method which is executed when the command is invoked.
```go
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.
```go
func init() {
register([]backend.Command{
&DoSomething{},
})
}
```
# Implementing Commands
If you are interested in implementing a command, see the [Implementing commands wiki page](https://github.com/limetext/lime/wiki/Implementing-commands).
# Other References
* Lime's [command interface API documentation](http://godoc.org/github.com/limetext/backend#Command)
* Sublime Text 3's unofficial (and [open source](https://github.com/guillermooo/sublime-undocs/)!) [command documentation](http://docs.sublimetext.info/en/sublime-text-3/extensibility/commands.html)