You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 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>
Copy file name to clipboardExpand all lines: docs/user/README.md
+61-1Lines changed: 61 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -216,16 +216,37 @@ eg:
216
216
`take line [blue] air`
217
217
Selects the line including the token containing letter 'a' with a blue hat.
218
218
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
+
219
226
##### `"file"`
220
227
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.
222
229
223
230
-`"copy file"`
224
231
-`"take file"`
225
232
-`"take file blue air"`
226
233
227
234
For example, `"take file [blue] air"` selects the file including the token containing letter 'a' with a blue hat.
228
235
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
+
229
250
##### `"token"`
230
251
231
252
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
234
255
-`"take token"`
235
256
-`"chuck token"`
236
257
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
+
237
273
##### Surrounding pair
238
274
239
275
Cursorless has support for expanding the selection to the nearest containing paired delimiter, eg the surrounding parentheses.
@@ -296,6 +332,20 @@ eg:
296
332
`take blue air past green bat`
297
333
Selects the range from the token containing letter 'a' with a blue hat past the token containing letter 'b' with a green hat.
298
334
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
+
299
349
#### List targets
300
350
301
351
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:
418
468
`move blue air to green bat`
419
469
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.
420
470
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
+
421
481
### Wrap/Rewrap
422
482
423
483
The wrap command can be used to wrap a given target with a pair of symbols
0 commit comments