Skip to content

Commit

Permalink
feat: command palette
Browse files Browse the repository at this point in the history
  • Loading branch information
cfoust committed Jan 16, 2024
1 parent 8a31ff2 commit 1f12b25
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/src/configuration.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Configuration

All of `cy`'s behavior is determined using a programming language called [Janet](https://janet-lang.org/), which is a fun, embeddable [Lisp](<https://en.wikipedia.org/wiki/Lisp_(programming_language)>) that is easy to learn and comes out of the box with a comprehensive standard library. If you are new to Janet, I recommend starting out with its [documentation](https://janet-lang.org/docs/syntax.html) and Ian Henry's fantastic [_Janet for Mortals_](https://janet.guide/).
All of `cy`'s behavior is determined using a programming language called [Janet](https://janet-lang.org/), which is a fun, embeddable [Lisp-like](<https://en.wikipedia.org/wiki/Lisp_(programming_language)>) language that is easy to learn. If you are new to Janet, I recommend starting out with its [documentation](https://janet-lang.org/docs/syntax.html) and Ian Henry's fantastic [_Janet for Mortals_](https://janet.guide/).

Janet looks like this:

Expand All @@ -24,6 +24,8 @@ On startup, `cy` will search for and execute the first file containing Janet sou
1. `$HOME/.config/cyrc.janet`
1. `$HOME/.config/.cy.janet`

For now, there is no way to reload your configuration; if you make changes to your configuration file, you'll need to restart cy.

Your `cy` configuration can contain any valid Janet statement, but `cy` also provides additions to the standard library in the form of [an API](./api.md) for controlling every aspect of how `cy` works.

### Example configuration
Expand Down
10 changes: 10 additions & 0 deletions docs/src/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,13 @@ The controls should be familiar to you if you have ever used a fuzzy finder:

- `ctrl+a` `k`: Jump to a project.
- `ctrl+a` `l`: Jump to a shell based on its current working directory.

## 7. Using the command palette

{{story cast cy/palette}}

Like most modern applications, `cy` includes a command palette, which lets you search through and execute all of the available actions. You can access it by typing `ctrl+a` `ctrl+p`.

## 8. Quitting cy

You can kill the cy server by hitting `ctrl+a` `q` and detach from it (but leave the server running with `ctrl+a` `d`.
18 changes: 18 additions & 0 deletions pkg/cy/stories.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,22 @@ func init() {
stories.Wait(stories.ALot),
},
})

stories.Register("cy/palette", initWithFrame, stories.Config{
Input: []interface{}{
stories.Wait(stories.Some),
stories.Type("ctrl+a", "ctrl+p"),
stories.Wait(stories.More),
stories.Type("choose"),
stories.Wait(stories.Some),
stories.Type("enter"),
stories.Wait(stories.Some),
stories.Type("down"),
stories.Wait(stories.Some),
stories.Type("down"),
stories.Wait(stories.Some),
stories.Type("enter"),
stories.Wait(stories.ALot),
},
})
}

0 comments on commit 1f12b25

Please sign in to comment.