Skip to content

Document custom command action #2921

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all 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.

- Utilizes default Cursorless spoken forms in the command string.
- Optional target arguments can be interpolated in the command string.

#### Examples

`"scratch"` => `"chuck block"`

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

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

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

`"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