Repository navigation
feat: opt-in RStudio keyboard shortcuts (r.keybindings.rstudio) - #1885
Open
roaldarbol wants to merge 1 commit into
Open
roaldarbol wants to merge 1 commit into
roaldarbol wants to merge 1 commit into
Conversation
With r.keybindings.rstudio on (off by default): Alt+- inserts <- and Ctrl/Cmd+Shift+M the pipe chosen in r.keybindings.pipe (native |> or magrittr %>%) in R, R Markdown and Quarto files; Ctrl/Cmd+Shift+L/T/D/E/B load all, test, document, check and install the package in R and R Markdown files. Keybindings with config.* when clauses, as in LaTeX Workshop, so a setting (e.g. in a dev container) turns them on for everyone. Discussed in REditorSupport#1787 (formerly REditorSupport#551). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
roaldarbol
marked this pull request as ready for review
October 20, 2026 09:40
4 tasks
eitsupi
requested changes
Oct 20, 2026
eitsupi
left a comment
Member
There was a problem hiding this comment.
This comment is based on an analysis by ChatGPT.
I have several concerns about adding RStudio-specific keybindings to vscode-R itself.
- VS Code already provides a flexible mechanism for users to configure individual keybindings. I'm not convinced we need an additional setting to manage them.
- Enabling
r.keybindings.rstudiooverrides several standard VS Code shortcuts at once. The effects are not immediately obvious from the setting name, and users may want to enable some shortcuts without replacing others. - The bindings also apply to R Markdown and Quarto files without checking whether the cursor is inside an R code chunk. This means R-specific shortcuts can be triggered while editing Markdown, YAML, or even non-R code chunks.
- I think vscode-R should focus on providing R-specific commands, while leaving key assignments to VS Code's existing keybinding mechanism.
- If distributing a predefined keymap is important, a separate keymap extension would provide a clearer separation of responsibilities.
While sharing keybindings across a team is a valid use case, I would prefer documenting the suggested mappings in the Wiki so users can copy and customize them in keybindings.json, rather than introducing additional settings and maintaining an RStudio-specific keymap in vscode-R.
Collaborator
|
I agree with @eitsupi that we should avoid adding keybindings that conflict with VSCode's default keybindings. I'd even suggest removing keybindings defined by the extension, at least those that conflict with VS Code defaults (notably Ctrl+Shift+S). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows up on #1787 (formerly #551), where an opt-in setting for RStudio-like keymaps was suggested and marked as help wanted.
What
A setting,
r.keybindings.rstudio(off by default), that turns on RStudio's R-specific shortcuts:Alt+-<-Ctrl+Shift+Mr.keybindings.pipe:|>(native, default) or%>%(magrittr)Ctrl+Shift+Lr.loadAllCtrl+Shift+Tr.testCtrl+Shift+Dr.documentCtrl+Shift+Er.checkCtrl+Shift+Br.installFollowing the discussion's caveats, it covers R-specific shortcuts only, not RStudio's general editor ones, and they apply only in R files.
How
Only
package.json: the keybindings are contributed withconfig.r.keybindings.rstudio(andconfig.r.keybindings.pipe) in theirwhenclauses, as LaTeX Workshop does for its alternative keymap. So there's one set of default keybindings, and the RStudio one is a setting away. Because it's a setting, it can also be turned on for a team, e.g. in a dev container'scustomizations.vscode.settings, which is how I came to this: our R developers shouldn't each have to copy keybindings into their ownkeybindings.jsonfor every project.Open questions
Alt+-andCtrl+Shift+Malso work in the console. A terminal binding (workbench.action.terminal.sendSequence) needs to know the focused terminal is an R one, or it would also fire in e.g. bash. There's no context key for that yet;TerminalSessionRegistry/switchSessionByTerminalcould set one (sayr.terminalFocus). Would you want that here, or separately?r.keybindings.rstudio/r.keybindings.pipe, and whether the devtools shortcuts belong in (they override more VS Code defaults than the two inserts).Testing
Draft: checked that
package.jsonis valid, that every keybinding's command exists, and that both settings are declared. Not yet tried in the Extension Development Host.🤖 Generated with Claude Code