Skip to content

Commit 2d93ee3

Browse files
Will-Sommerspokey
andauthored
Various additions to documentation (#703)
* Add various additions to documentation * Add head/tail to scopes list * Update Readme according to feedback * Apply suggestions from code review * Tweaks * Tweaks * Revert fix to old cheatsheet Co-authored-by: Pokey Rule <755842+pokey@users.noreply.github.com>
1 parent 385d04b commit 2d93ee3

File tree

1 file changed

+61
-1
lines changed

1 file changed

+61
-1
lines changed

docs/user/README.md

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,16 +216,37 @@ eg:
216216
`take line [blue] air`
217217
Selects the line including the token containing letter 'a' with a blue hat.
218218

219+
##### `"block"`
220+
221+
The `"block"` modifier expands to above and below the target to select lines until an empty line is reached.
222+
223+
- `"take block"`
224+
- `"take block <TARGET>"`
225+
219226
##### `"file"`
220227

221-
The word file can be used to expand the target to refer to the entire file.
228+
The word '`"file"` can be used to expand the target to refer to the entire file.
222229

223230
- `"copy file"`
224231
- `"take file"`
225232
- `"take file blue air"`
226233

227234
For example, `"take file [blue] air"` selects the file including the token containing letter 'a' with a blue hat.
228235

236+
##### `"head"` and `"tail"`
237+
238+
The modifiers `"head"` and `"tail"` can be used to expand a target through the beginning or end of the line, respectively.
239+
240+
- `"take head"`: select from the cursor the start of the line
241+
- `"take tail"`: select from the cursor to the end of the line
242+
- `"take head air"`: selects the mark through to start of the line
243+
- `"take tail air"`: selects the mark through to the end of the line
244+
245+
When followed by a modifier, they will expand their input to the start or end of the given modifier range. For example:
246+
247+
- `"take head funk"`: select from the cursor the start of the containing function
248+
- `"chuck tail class air"`: Delete from the token with a hat over the letter `a` through the end of its containing class
249+
229250
##### `"token"`
230251

231252
The `"token"` modifier expands its input to the nearest containing token. This modifier is often used without a mark, either to select the token adjacent to your cursor or to expand your selection to the nearest containing token range. For example:
@@ -234,6 +255,21 @@ The `"token"` modifier expands its input to the nearest containing token. This m
234255
- `"take token"`
235256
- `"chuck token"`
236257

258+
##### `"paint"`
259+
260+
Both of the commands below will expand from the mark forward and backward to include all adjacent non-whitespace characters.
261+
262+
- `"take paint"`
263+
- `"take paint <TARGET>"`
264+
265+
For example, in the following text:
266+
267+
```
268+
foo.bar baz|bongo
269+
```
270+
271+
Saying `"every paint"` would select `foo.bar` and `baz|bongo`.
272+
237273
##### Surrounding pair
238274

239275
Cursorless has support for expanding the selection to the nearest containing paired delimiter, eg the surrounding parentheses.
@@ -296,6 +332,20 @@ eg:
296332
`take blue air past green bat`
297333
Selects the range from the token containing letter 'a' with a blue hat past the token containing letter 'b' with a green hat.
298334

335+
##### Vertical ranges
336+
337+
The `"slice"` range modifier is used to refer to multiple targets that are vertically aligned. It is commonly used with the `"pre"` action to add multiple cursors to the editor. Each cursor is inserted at the same column on each row requested within the command.
338+
339+
- `"pre <TARGET 1> slice past <TARGET 2>"`: Add cursors from the first target through to the second target's line(inclusive end)
340+
- `"pre <TARGET 1> slice <TARGET 2>"`: Shortened version of above `"slice past"` command
341+
- `"pre <TARGET 1> slice until <TARGET 2>"`: Add cursors until the second target's line(non-inclusive end)
342+
- `"pre <TARGET 1> slice between <TARGET 2>"`: Add cursors between first and second target's lines(non-inclusive start and end)
343+
344+
For example:
345+
346+
- `"pre air slice bat"`: Places cursors at the same position on every line (inclusive) between token with hat over the `a` and token with the hat over the `b`. The position will be the start of the token with a hat over the `a`
347+
- `"chuck tail air slice end of block"`: Delete the end of every line from air through the end of its non-empty line block.
348+
299349
#### List targets
300350

301351
In addition to range targets, cursorless supports list targets, which allow you to refer to multiple targets at the same time. When combined with the `"take"` action, this will result in multiple cursors, for other actions, such as `"chuck"` the action will be applied to all the different targets at once.
@@ -418,6 +468,16 @@ eg:
418468
`move blue air to green bat`
419469
Replaces the token containing letter 'b' with a green hat using the token containing letter 'a' with a blue hat, and the delete the latter token.
420470

471+
### Reverse/Shuffle/Sort
472+
473+
These commands accept multiple selections, and change their order. For example:
474+
475+
- `"shuffle every item <TARGET>"`
476+
- `"sort every item <TARGET>"`
477+
- `"reverse every item <TARGET>"`
478+
- `"sort line air slice bat"`: sort lines within the selection.
479+
- `"sort this"`: Sort the multiple selections.
480+
421481
### Wrap/Rewrap
422482

423483
The wrap command can be used to wrap a given target with a pair of symbols

0 commit comments

Comments
 (0)