Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions packages/cursorless-org-docs/src/docs/user/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,36 @@ _You can disable the default Cursorless reformat command by prefixing the spoken
<user.formatters> form <user.cursorless_target>:
user.cursorless_reformat(cursorless_target, formatters)
```

### Experimental custom command action

_NOTE that this feature is experimental. Not as thoroughly tested as the rest of Cursorless and might change in the future_

`user.cursorless_custom_command(command: string, *args)`

Run a custom Cursorless command by parsing the specified command string. Supports a subset of the Cursorless grammar, with **default** spoken forms (not your custom spoken forms). See https://www.cursorless.org/custom-command-railroad to see the subset of our grammar that we support today.

- Utilizes default Cursorless spoken forms in the command string.
- Optional target arguments can be interpolated in the command string. (see examples below)

#### Examples

In order to map `"scratch"` to perform `"chuck block"`:

```talon
scratch: user.cursorless_custom_command("chuck block")
```

To map `"scratch air"` => `"chuck block air"`

```talon
scratch <user.cursorless_target>:
user.cursorless_custom_command("chuck block <target>", cursorless_target)
```

To map `"combine air plus bat"` => `"bring block air after bat"`

```talon
combine <user.cursorless_target> plus <user.cursorless_target>:
user.cursorless_custom_command("bring block <target1> after <target2>", cursorless_target_1, cursorless_target_2)
```
Loading