Skip to content

intro doc WIP with some concepts and a few example walk throughs #1538

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

Closed
wants to merge 28 commits into from

Conversation

jmegner
Copy link
Collaborator

@jmegner jmegner commented Jun 18, 2023

I'll put in a lot more links once we start firming up the content. Feel free to suggest big changes.

@jmegner jmegner changed the title intro doc first draft with some concepts and no example walk throughs intro doc WIP with some concepts and no example walk throughs Jun 18, 2023
Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice start! I left some comments inline

Comment on lines 9 to 14
Commands have an action and a target or two. `"chuck air"` has the action `"chuck"` and one target (the `"air"` token).
`"bring air to bat"` has the action `"bring"` and two targets (the `"air"` and `"bat"` tokens).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the user supposed to be in there user journey when they arrive here? If this is supposed to be one of the first things they see, then they almost certainly won't know what "the "air" token" means

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent question. From our group talk, I think we all agreed on this being a Part 2 of a three part series.

  1. Basic. Try to get people to understand "take air", "chuck row 33" and probably highlight the most useful actions.
  2. THIS DOC, intermediate. Getting people beyond the very basics, to start using chained modifiers and understanding the underlying structure of cursorless. Highlight the most useful modifiers and combinations of concepts.
  3. Advanced. At the least, will include: snippets, pairs (if I didn't cover them in part 2), every, instance, just.

A target can even be a vertical slice or list, like the list `"air and bat"`.
Doing `"take air and bat"` will result in multiple selections and multiple cursors, but it is still one target.

Commands with two targets often require a separator word between the two targets, like the `"to"` in `"move air to bat"`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not entirely accurate to call "to" a separator word. It actually turns "bat" into a destination. The "move" action expects a destination for its second argument. The words "to", "after", and "before" are the three ways to turn a target into a destination

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will work on how best to introduce the concept of destination. Thanks.

Commands with two targets often require a separator word between the two targets, like the `"to"` in `"move air to bat"`.
The separator may seem trivial now, but it is easier to forget it when you start using fancy targets.

### Targets Can Be Modified
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpicking here, but I prefer just capitalizing the first word of section headings

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I can play nice with that.


### Targets Can Be Modified

A target starts as a mark (`"this"`, `"row ten"`, `"green curve air"`, etc) and target modifiers can be applied to suit your needs.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"starts" is a bit confusing here. It's true that the pipeline logically emanates from a mark, but it is actually the last word you'll say when naming a target

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make it more clear. Perhaps: "A target contains a mark and target modifiers can be prefixed to suit your needs."

`"chuck just bat"` will not delete any spaces; the `"just"` causes the command to ignore delimiters.
`"take just just just bat"` does the same as `"take bat"`.

Special positional target modifiers `"before"` and `"after"` try to work with delimiters.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as mentioned elsewhere, I'm hesitant to add more of the old language around "positional target modifiers". These are required words to form a destination

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have to rewrite this once I write up the earlier stuff about destinations.

Comment on lines 55 to 56
Special positional target modifiers `"start of"` and `"end of"` do not use delimiters.
`"bring line to end of row ten"` will bring a copy of the current line content _without line delimiter_ to the end of line 10, meaning line 10 will get content added to it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not sure how important this is to learn at the start. and you'd likely be better served saying "bring line after last token row ten" anyway so that you get a space

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is much extra mental burden to know that "before" and "after" have counterparts that don't use delimiters. I think this is the best time to introduce it. I wouldn't get too focused on the practicality of that exact example. I have asked for slack-help on how to do something and got answers with "start of". Maybe was a quirk of how I learned things, but things really clicked when I learned about all four positional "modifiers"; it felt like a small thing with a big impact.

- `"bring T1 [to T2]"`: replace selection/T2 with T
- `"move T1 [to T2]"`
- `"chuck T"`: delete T
- `"change T"`: delete T and set cursor(s) to where T was
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given all the discussion of delimiters above, it might be worth indicating here or somewhere that "change" doesn't remove delimiters

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, maybe it is chuck that should be changed to say that it will delete appropriate delimiters as well.

- `"drink/pour T"`: edit new line before/after T
- Selection Manipulation
- `"take T"`: set selection
- `"give T"`: deselect
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder how common this one is

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

give? Not that common, I guess. I think it originally got into my notes because it felt important at the time. Sometimes I wanted to not have a selection because of its interactions with search stuff. BUT, give this doesn't even work for that. I now use "pre this" or something like "go left". I think I'll delete give from the list.

- `"give T"`: deselect
- `"pre/post T"`: set selection before/after T
- Clipboard
- `"paste to T"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to include "paste before" / "paste after"?

Copy link
Collaborator Author

@jmegner jmegner Jun 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! I even want to add it to the cheatsheet.

The big difference between a simple command `"bring air to bat"` and the intimidating `"bring next three tokens air to after just line bat"` is the addition of target modifiers.
Target modifiers are often chained. `"after just line"` is a chain of three modifiers and they are applied in reverse order (`"line"`, then `"just"`, then `"after"`).
The biggest difference between the simple `"bring air to bat"` and the intimidating `"bring next three lines air to tail block bat"` is the addition of target modifiers.
Target modifiers are often chained. `"tail block"` is a chain of two modifiers and they are applied in reverse order (`"block"`, then `"tail"`).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"tail block" is actually a single modifier 😅. It extends its input past the end of its containing block

Copy link
Member

@pokey pokey Jun 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're looking for an intimidating command with a big fancy chain, maybe grab one from one of my videos? eg https://youtu.be/xtOkYdwUves ("move line every instance square plex after file"). Tho keep in mind in that example the second target (the destination "after file") doesn't actually have an explicit mark; it's using the implicit "just this" mark

But the source does break down as a nice long chain. Reading from right to left, it's:

  1. plex
  2. square ("box" in default parlance)
  3. every instance
  4. line

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hoping to have an example that would be fully explained by the current document; "every instance" is going to be in the next document. I can just change to "block func".

Target modifiers are often chained. `"tail block"` is a chain of two modifiers and they are applied in reverse order (`"block"`, then `"tail"`).

Modifier chains can be applied to each [primitive target](README.md#primitive-targets) in a [compound target](README.md#compound-targets).
For instance, `"take tail line air and head block bat"` has chain `"tail line"` applied to `"air"` and chain `"head block"` applied to `"bat"`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as above, neither of these are really "chains": they're each a single modifier

Targets are converted into destinations using a destination converter (`"to"`, `"before"`, `"after"`); that is why you have to say commands like `"bring air to bat"` or `"bring air before bat"`.
The `"to"` might seem like cursorless is trying to resemble a sentence, but `"to"` actually serves a technical purpose of explicitly converting to a destination.

Your destinations should start with a single destination converter before you add modifiers and/or a mark.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be worth having examples for "paste" / maybe "snippet"


### Targets Sometimes Include Their Delimiter Depending On The Action And Modifiers
Commands like `"paste"`, `"bring"`, and `"move"` have a target that is a destination.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prob worth pointing out htat for bring and move the second arg is destination: first is regular target

@jmegner jmegner changed the title intro doc WIP with some concepts and no example walk throughs intro doc WIP with some concepts and a few example walk throughs Jun 23, 2023
@pokey
Copy link
Member

pokey commented Jul 9, 2023

just wanted to check that this isn't blocked on anything from me?

@jmegner
Copy link
Collaborator Author

jmegner commented Jul 24, 2023

I feel like I should have had more examples, but some of them should go in the advanced guide and this should be a good enough start anyway.

Feel free to choose a better filename. guide-intermediate.md?

@jmegner
Copy link
Collaborator Author

jmegner commented Aug 7, 2023

Some notes from talking with @josharian ...

Agreed and fairly straightforward:

  • move useful actions/modifiers sections to top (and change intro a bit).
  • terser section titles even if less precise.
  • Some of the simple-when-you-see-it should have example before the technical explanation (chained modifiers, destination converters come before target modifiers).
  • fix "character or word" vs "argument and item".
  • some action reordering; select a manipulation first; chuck and change first in changers list
  • drink/pour are not just for lines (like args)
  • add IDE action category (like follow)
  • remove 'n scopes backwards' modifier

Jacob will think about:

  • Where to add/promote examples that have their own code block rather than an inline before-vs-after.

Controversy!

  • suggested new section for intersection of destination & delimiter (not sure I understood)
  • A lot of tweaking can be done for the top-level examples section. We concentrated on the other top level sections.
  • Whether to distinguish marks vs targets.
  • How to explain syntactic scopes.

Stuff to remember for when we have more than one guide doc

  • mention fewer useful modifiers
  • move join & split examples out, especially to future docs where we talk more about customization
  • "bring air to its arg" does "f(g(a), b)" => "f(a, b)"; the its makes it out of scope for this doc
  • it would be nice to have some extra support for before-vs-after examples, like a good way to show cursors, selections, and hats. Someone would have to wizard something up, which means it won't happen soon. Maybe it would be worthwhile to come up with some plaintext conventions like ^angry| a^pple to show hat assignment and cursor position, but I doubt it.

@jmegner
Copy link
Collaborator Author

jmegner commented Aug 10, 2023

@pokey I think it is ready for you to look again.

@jmegner jmegner marked this pull request as ready for review August 13, 2023 19:34
Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a quick pass through the first quarter of this doc. Some great stuff here; left a bunch of minor comments


This document will try to:

- Highlight the most useful actions and modifiers in Cursorless so you know which ones to focus on learning first.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If intermediate, then not sure "learning first" is the right term?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me, "getting to beginner level in cursorless" is pretty shallow. It's understanding hats, this, and a few commands. You don't know all the commands nor do you know which ones are important. Intermediate users at least roughly know which commands they should know. That is actually significant knowledge. You might be surprised how long people limp along with a very small number of commands while knowing they should learn more.


- Highlight the most useful actions and modifiers in Cursorless so you know which ones to focus on learning first.
- Bring together a few important concepts that underlie a lot of Cursorless behavior.
- Walk through some example editing operations that are common but perhaps tricky to a beginner.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If intermediate, should we use "beginner" here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The examples are tricky to a beginner who hasn't internalized the stuff in this doc. They won't be nearly so tricky once you are fully intermediate.

Copy link
Collaborator Author

@jmegner jmegner Sep 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partially based on Jan Wessling saying that the doc comes across as not for beginners...

Highlight the actions and modifiers in Cursorless that the pros use most

That makes it sound like the guide is not for people who are currently beginners. "Highlight the most useful actions and modifiers in Cursorless so you know which ones to focus on learning first" is our intent.

Starting to feel comfortable with the basics?

I would say this guide is not for people who would described themselves as feeling comfortable, even if it is qualified "with the basics".

How about "Do you understand the very basics of how say a command that uses a hat?" instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change title to "Getting comfortable with Cursorless" and make no mention of the word "intermediate" unless we are explicitly saying the guide is to help beginners get to intermediate.

- `"take T"`: set selection.
- `"pre/post T"`: set selection before/after T.
- Clipboard
- `"paste to/before/after T"`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe separate this one into "paste to" vs "paste before/after", as you've done with "bring", and add the same note about inserting delimiters?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right; this used to be below bring, so I didn't bother. I will give it the "bring" treatment.

- `"bring T1 to T2"`: replace T2 with T.
- `"bring T1 before/after T2"`: insert a copy of T1 before/after T2, including appropriate delimiters.
- `"move T1 [to/before/after T2]"`: like `"bring"`, but moves instead of copies.
- `"chuck T"`: delete T and appropriate delimiter.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to link from "appropriate delimiter" to a deeper discussion with examples?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will link to the "Delimiters" section.

- `"arg"` and `"item"`: often used to involve commas, like `"chuck item air"` or `"bring air after arg bat"` that take care of commas.
- `"funk"` for function.
- `"state"` for statement (which might span multiple lines or only part of a line).
- Other modifiers that are like syntactic scopes in that they expand the target.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Other modifiers that are like syntactic scopes in that they expand the target.

Comment on lines 60 to 61
- `"[number] [scope]s"`, like `"chuck three lines row 12"` to delete rows 12-14.
- `"[number] [scope]s backward"`, like `"chuck three lines backward row 12"` to delete rows 10-12.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would lean towards using "air" instead of "row 12" here, per discussion on Discord, but not opposed to keeping this to give some variety.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will change "chuck three lines row 12" to "chuck three lines air" to demonstrate you do not have to supply a line oriented target to n lines.

### Command structure

Commands have an action and a target or two. `"chuck air"` has the action `"chuck"` and one target (the `"air"` token).
`"bring air to bat"` has the action `"bring"` and two targets (the `"air"` and `"bat"` tokens).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case "bring" actually accepts a target and a destination. "to bat" is a destination. Not sure if it's better to be slightly wrong here tho

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought destinations were a special kind of target.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not how we're viewing them today, but I wouldn't say that's wildly inaccurate, and I won't rule out the possibility we'll view them that way at some point in the future 😅. @AndreasArvidsson any opinion on this one?

Copy link
Member

@AndreasArvidsson AndreasArvidsson Aug 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since a destination is only a wrapper around the target it's not that inaccurate.
air = target
to = insertion mode
to air = destination

I have definitely referred to destinations as targets sometimes. That said I'm not sure if it's a good habit or not :D


A target can be more than a single token or line. A target can be a [range](README.md#range-targets), like `"air past bat"` that spans from the `"air"` token to the `"bat"` token, and that is still considered _one_ target.
A target can even be a vertical slice or list, like the list `"air and bat"`.
Doing `"take air and bat"` will result in multiple selections and multiple cursors, but it is still one target.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do wonder how important this distinction is. We're actually not even consistent on this point internally. When the command comes from Talon to VSCode, it comes across as a single logical target, but after running our target pipeline, we call each output a target

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These statements were helpful to my understanding when I internalized them. It also helps when reading the reference or talking to other people.

@jmegner jmegner added the documentation Improvements or additions to documentation label Aug 21, 2023

- Words in square braces (`[]`) are optional, eg `hello [world]` means you can say `"hello"` or `"hello world"`.
- Slashes (`/`) show alternatives. For example, `hello/world` means you can say `"hello"` or `"world"`.
- Targets are represented by `T` with a possible digit, eg `T` or `T1` or `T2`. For example, `bring T1 to T2` means you can say `"bring air to bat"`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to include examples in this section? I like the idea of being example-heavy

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Examples of what?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you mean examples of the [T/T1/T2] syntax, what you have seems good.

@jmegner
Copy link
Collaborator Author

jmegner commented Dec 24, 2023

I'm semi-back from other stuff. I think you last mentioned about breaking the PR into smaller chunks, and it makes sense for the author to do it as they work, but since I am no longer adding stuff, you have all the info I have for however you want to merge it in. I don't know what chunking you would find most helpful.

jmegner added a commit to jmegner/cursorless-unofficial-doc that referenced this pull request Feb 23, 2024
@jmegner
Copy link
Collaborator Author

jmegner commented Feb 23, 2024

@pokey
Copy link
Member

pokey commented Jun 20, 2024

Shall we close this now that it has its own home? We can start to integrate pieces of your guide into the official docs as we move forward

@jmegner
Copy link
Collaborator Author

jmegner commented Jun 20, 2024

Sounds good to me.

@jmegner jmegner closed this Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants