diff --git a/README.Rmd b/README.Rmd index f961efe..bd6ed35 100644 --- a/README.Rmd +++ b/README.Rmd @@ -35,6 +35,29 @@ pak::pak("simonpcouch/pal") Then, ensure that you have an [`ANTHROPIC_API_KEY`](https://console.anthropic.com/) environment variable set, and you're ready to go. If you'd like to use an LLM other than Anthropic's Claude 3.5 Sonnet—like OpenAI's ChatGPT—to power the pal, see the [Getting started with pal](https://simonpcouch.github.io/pal/articles/pal.html) vignette. +Pals are interfaced with the via the pal addin. For easiest access, we recommend registering the pal addin to a keyboard shortcut. + +**In RStudio**, navigate to `Tools > Modify Keyboard Shortcuts > Search "Pal"`—we suggest `Ctrl+Alt+P` (or `Ctrl+Cmd+P` on macOS). + +**In Positron**, you'll need to open the command palette, run "Open Keyboard Shortcuts (JSON)", and paste the following into your `keybindings.json`: + +```json + { + "key": "Ctrl+Cmd+P", + "command": "workbench.action.executeCode.console", + "when": "editorTextFocus", + "args": { + "langId": "r", + "code": "pal::.init_addin()", + "focus": true + } + } +``` + +The analogous keybinding on non-macOS is `Ctrl+Alt+P`. That said, change the `"key"` entry to any keybinding you wish! + +Once those steps are completed, you're ready to use pals with a keyboard shortcut. + ## Example Pals are created automatically when users interact with the pal addin. Just highlight some code, open the addin, begin typing the "role" of your pal and press "Return", and watch your code be rewritten: diff --git a/README.md b/README.md index 8ba5122..69d03e3 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,36 @@ than Anthropic’s Claude 3.5 Sonnet—like OpenAI’s ChatGPT—to power the pal, see the [Getting started with pal](https://simonpcouch.github.io/pal/articles/pal.html) vignette. +Pals are interfaced with the via the pal addin. For easiest access, we +recommend registering the pal addin to a keyboard shortcut. + +**In RStudio**, navigate to +`Tools > Modify Keyboard Shortcuts > Search "Pal"`—we suggest +`Ctrl+Alt+P` (or `Ctrl+Cmd+P` on macOS). + +**In Positron**, you’ll need to open the command palette, run “Open +Keyboard Shortcuts (JSON)”, and paste the following into your +`keybindings.json`: + +``` json + { + "key": "Ctrl+Cmd+P", + "command": "workbench.action.executeCode.console", + "when": "editorTextFocus", + "args": { + "langId": "r", + "code": "pal::.init_addin()", + "focus": true + } + } +``` + +The analogous keybinding on non-macOS is `Ctrl+Alt+P`. That said, change +the `"key"` entry to any keybinding you wish! + +Once those steps are completed, you’re ready to use pals with a keyboard +shortcut. + ## Example Pals are created automatically when users interact with the pal addin. diff --git a/vignettes/pal.Rmd b/vignettes/pal.Rmd index 316b619..bc74b8d 100644 --- a/vignettes/pal.Rmd +++ b/vignettes/pal.Rmd @@ -62,7 +62,28 @@ Just: ![](https://raw.githubusercontent.com/simonpcouch/pal/refs/heads/main/inst/figs/addin.gif) -For easiest access, the pal addin can be registered with a keyboard shortcut. To do so in RStudio, navigate to `Tools > Modify Keyboard Shortcuts > Search "Pal"`—we suggest `Ctrl+Alt+P` (or `Ctrl+Cmd+P` on macOS). +Pals are interfaced with the via the pal addin. For easiest access, we recommend registering the pal addin to a keyboard shortcut. + +**In RStudio**, navigate to `Tools > Modify Keyboard Shortcuts > Search "Pal"`—we suggest `Ctrl+Alt+P` (or `Ctrl+Cmd+P` on macOS). + +**In Positron**, you'll need to open the command palette, run "Open Keyboard Shortcuts (JSON)", and paste the following into your `keybindings.json()`: + +```json + { + "key": "Ctrl+Cmd+P", + "command": "workbench.action.executeCode.console", + "when": "editorTextFocus", + "args": { + "langId": "r", + "code": "pal::.init_addin()", + "focus": true + } + } +``` + +The analogous keybinding on non-macOS is `Ctrl+Alt+P`. That said, change the `"key"` entry to any keybinding you wish! + +Once those steps are completed, you're ready to use pals with a keyboard shortcut. ## Adding custom pals