Skip to content

Commit e0a9806

Browse files
CodesAwaypre-commit-ci-lite[bot]pokey
authored
Add section for experimental custom regex scopes to customization.md (#2315)
## Checklist - [X] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [X] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [X] I have not broken the cheatsheet * No functionality was changed, so no tests were written * Updated docs, but not cheatsheet (since it's only user settings change, not Cursorless change) * No changes to cheatsheet were made --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Co-authored-by: Pokey Rule <[email protected]>
1 parent 02e7087 commit e0a9806

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

docs/user/customization.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,40 @@ push down, editor.action.moveLinesDownAction
7070

7171
Now when you say eg "push down air and bat", cursorless will first select the two tokens with a gray hat over the `a` and `b`, then issue the VSCode command `editor.action.moveLinesDownAction`, and then restore your original selection.
7272

73+
## \[Experimental\] Cursorless custom regex scopes
74+
75+
You can define custom scopes using regexes in `user/cursorless-settings/experimental/regex_scope_types.csv`
76+
77+
:::tip
78+
79+
Use `"visualize <scope>"` to see a live preview of the regex scope in [the scope visualizer](./scope-visualizer.md). It updates in real time every time you save `regex_scope_types.csv`.
80+
81+
:::
82+
83+
For example, here's what `"visualize dotted"` would show with the scope type `dotted,"[\w.]+"`:
84+
85+
<div class="light-mode-invert">
86+
![visualization of a custom regex scope](./images/custom-regex-scopes.png)
87+
</div>
88+
89+
You can then use commands such as
90+
91+
- `"take dotted sun"` to select `user.text` (line 10)
92+
- `"copy dotted urge"` to copy `user.chrome_mod` (line 11)
93+
- `"take every dotted urge"` to select `user.chrome_mod`, `shift`, and `a`
94+
95+
:::tip
96+
97+
> Check out [our wiki page](https://github.com/cursorless-dev/cursorless/wiki/Custom-regex-scopes) for a recipe book of user-created regex scopes!
98+
99+
:::
100+
101+
:::warning
102+
103+
Regex matches cannot cross line boundaries (so multiline matches are not supported). The regexes also have the unicode flag set.
104+
105+
:::
106+
73107
## Toggling "hat" display
74108

75109
It is possible to show / hide the hats with a command. Keep in mind that many users, often after less than a week using Cursorless, find that their brain starts to tune out the hat display. Some start to miss them when they're gone 🥲
48.8 KB
Loading

packages/cursorless-org-docs/src/css/custom.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@
2020
[data-theme="dark"] .dark-mode-invert {
2121
filter: invert(90%) hue-rotate(180deg);
2222
}
23+
24+
[data-theme="light"] .light-mode-invert {
25+
filter: invert(90%) hue-rotate(180deg);
26+
}

0 commit comments

Comments
 (0)