# Register actions statically / globally \(\#3264\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/d67581875fddeb05d39f2b55c18306068ea181d9)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: d67581875fddeb05d39f2b55c18306068ea181d9

Requested commit: d67581875fddeb05d39f2b55c18306068ea181d9

Commit: d67581875fddeb05d39f2b55c18306068ea181d9

Tree: 348b08de52787d9e4ecff5677f17d7335179c5da

Author: Nathan Sobo

Committer: GitHub

## Message

````
Register actions statically / globally (#3264)

This updates our approach to action registration to make it
static/global.

There are 3 different approaches to creating an action, depending on the
complexity of your action's implementation. All of them involve defining
a data type with the correct trait implementations and registering it,
each a bit more powerful / verbose.

* Define a simple list of unit structs that implement `Action` -
`actions!(Foo, Bar, Baz)`
* Make a more complex data type into an action with `#[action]`. This
derives all the necessary traits and registers the action.
  ```rs
  #[action]
  struct MoveLeft {
    word: true
  }
  ```
* Implement all traits yourself and just register the action with
`#[register_action]`.

Release Notes:

N/A
````

## Parents

- [776338d27a0ba0835ebdcb04d326155b9783769b](https://git.cafe/gitcafe/zed/commit/776338d27a0ba0835ebdcb04d326155b9783769b?format=markdown)

- [408edaae399123bd51e4399d3192b33d5a905aa7](https://git.cafe/gitcafe/zed/commit/408edaae399123bd51e4399d3192b33d5a905aa7?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/d67581875fddeb05d39f2b55c18306068ea181d9?format=markdown)
