Skip to content

Commit

Permalink
change recommended keyboard shortcuts
Browse files Browse the repository at this point in the history
chording seems to work fine by default in both RStudio + Positron!

closes #20
  • Loading branch information
simonpcouch committed Oct 8, 2024
1 parent 7fe8d97 commit 43fb55d
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 45 deletions.
8 changes: 7 additions & 1 deletion R/pal_cli.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@
#' Create a cli pal with:
#'
#' ```r
# TODO: add keybinding with `pal("cli", "Ctrl+Shift+C")`
# TODO: add keybinding with `pal("cli", "Cmd+;+C")`
#' pal("cli")
#' ```
#'
#'
#' We recommended binding the cli pal to the keyboard shortcut
#' `Cmd+;+C` ([written `Cmd+; Cmd+C`](https://www.emacswiki.org/emacs/key-chord.el))
#' via `Tools > Modify Keyboard Shortcuts > Search "Pal"` in RStudio.
#' Pals are typically prefixed with `Command + ;` (or `Alt + ;` on non-macOS).
#'
#' @section Cost:
#'
# TODO: make this a template that takes in the token counts and prices as input
Expand Down
5 changes: 5 additions & 0 deletions R/pal_roxygen.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
#' pal("roxygen")
#' ```
#'
#' We recommended binding the roxygen pal to the keyboard shortcut
#' `Cmd+;+R` ([written `Cmd+; Cmd+R`](https://www.emacswiki.org/emacs/key-chord.el))
#' via `Tools > Modify Keyboard Shortcuts > Search "Pal"` in RStudio.
#' Pals are typically prefixed with `Command + ;` (or `Alt + ;` on non-macOS).
#'
#' @section Cost:
#'
#' The system prompt from a roxygen pal includes something like 1,000 tokens.
Expand Down
7 changes: 6 additions & 1 deletion R/pal_testthat.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@
#' Create a testthat pal with:
#'
#' ```r
# TODO: add keybinding with `pal("testthat", "Ctrl+Shift+V")`
# TODO: add keybinding with `pal("testthat", "Cmd+;+C")`
#' pal("testthat")
#' ```
#'
#' We recommended binding the testthat pal to the keyboard shortcut
#' `Cmd+;+T` ([written `Cmd+; Cmd+T`](https://www.emacswiki.org/emacs/key-chord.el))
#' via `Tools > Modify Keyboard Shortcuts > Search "Pal"` in RStudio.
#' Pals are typically prefixed with `Command + ;` (or `Alt + ;` on non-macOS).
#'
#' @section Cost:
#'
#' The system prompt from a testthat pal includes something like 1,000 tokens.
Expand Down
10 changes: 5 additions & 5 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@ Then, ensure that you have an [`ANTHROPIC_API_KEY`](https://console.anthropic.co

## Example

To create a pal, simply pass `pal()` a pre-defined "role" and a keybinding you'd like it attached to. For example, to use the [cli pal](https://simonpcouch.github.io/pal/reference/pal_cli.html):
To create a pal, simply pass `pal()` a pre-defined "role" and a keybinding you'd like it attached to. For example, to use the [cli pal](https://simonpcouch.github.io/pal/reference/pal_cli.html) with the shortcut `Cmd+;+C` ([written `Cmd+; Cmd+C`](https://www.emacswiki.org/emacs/key-chord.el)):

```r
pal("cli", "Ctrl+Shift+C")
pal("cli", "Cmd+; Cmd+C")
```

Then, highlight some code, press the keyboard shortcut, and watch your code be rewritten:

![](https://github.com/simonpcouch/pal/raw/main/inst/figs/addin.gif)
As-is, the package provides ergonomic LLM assistants for R package development:

* `"cli"`: [Convert to cli](https://simonpcouch.github.io/pal/reference/pal_cli.html)
* `"testthat"`: [Convert to testthat 3](https://simonpcouch.github.io/pal/reference/pal_testthat.html)
* `"roxygen"`: [Document functions with roxygen](https://simonpcouch.github.io/pal/reference/pal_roxygen.html)
* `"cli"` with `Cmd+;+C`: [Convert to cli](https://simonpcouch.github.io/pal/reference/pal_cli.html)
* `"testthat"` with `Cmd+;+T`: [Convert to testthat 3](https://simonpcouch.github.io/pal/reference/pal_testthat.html)
* `"roxygen"` with `Cmd+;+R`: [Document functions with roxygen](https://simonpcouch.github.io/pal/reference/pal_roxygen.html)

That said, the package provides infrastructure for others to make LLM assistants for any task in R, from authoring to interactive data analysis. With only a markdown file and a function call, users can extend pal to assist with their own repetitive but hard-to-automate tasks.

Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ power the pal, see `?pal()` to set default metadata on that model.

To create a pal, simply pass `pal()` a pre-defined “role” and a
keybinding you’d like it attached to. For example, to use the [cli
pal](https://simonpcouch.github.io/pal/reference/pal_cli.html):
pal](https://simonpcouch.github.io/pal/reference/pal_cli.html) with the
shortcut `Cmd+;+C` ([written
`Cmd+; Cmd+C`](https://www.emacswiki.org/emacs/key-chord.el)):

``` r
pal("cli", "Ctrl+Shift+C")
pal("cli", "Cmd+; Cmd+C")
```

Then, highlight some code, press the keyboard shortcut, and watch your
Expand All @@ -53,11 +55,11 @@ code be rewritten:
As-is, the package provides ergonomic LLM assistants for R package
development:

- `"cli"`: [Convert to
- `"cli"` with `Cmd+;+C`: [Convert to
cli](https://simonpcouch.github.io/pal/reference/pal_cli.html)
- `"testthat"`: [Convert to testthat
- `"testthat"` with `Cmd+;+T`: [Convert to testthat
3](https://simonpcouch.github.io/pal/reference/pal_testthat.html)
- `"roxygen"`: [Document functions with
- `"roxygen"` with `Cmd+;+R`: [Document functions with
roxygen](https://simonpcouch.github.io/pal/reference/pal_roxygen.html)

That said, the package provides infrastructure for others to make LLM
Expand Down
18 changes: 11 additions & 7 deletions man/pal_cli.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 25 additions & 22 deletions man/pal_roxygen.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions man/pal_testthat.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 43fb55d

Please sign in to comment.