Skip to content
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

Add dedicated RStudio keymap #669

Closed
jmcphers opened this issue Jun 5, 2023 · 11 comments
Closed

Add dedicated RStudio keymap #669

jmcphers opened this issue Jun 5, 2023 · 11 comments
Labels
area: core Issues related to Core category.
Milestone

Comments

@jmcphers
Copy link
Collaborator

jmcphers commented Jun 5, 2023

Generally speaking, we want Positron to have VS Code-like keybindings, because its heritage as a VS Code based IDE is clear (it looks like VS Code, so people will expect it to act like VS Code) and (statistically) it is more likely that new Positron users will be coming from VS Code than any other IDE.

However, we also want to honor users coming from RStudio. Towards that end, we should create an RStudio keymap that brings most of RStudio's shortcuts to Positron, removing any default VS Code bindings that conflict.

For example (noted by @DavisVaughan), in RStudio, Comment Selection is Cmd + Shift + C, but in VS Code that combination opens a new external terminal. With the RStudio Keymap activated, the RStudio behavior will take precedence.

For another example: in VS Code, Ctrl + 1 and Ctrl + 2 activate the first and second editor tabs, respectively. In RStudio, they switch between the Source and Console panes. These commands should exist in Positron, but we probably don't want to stomp on VS Code's keybindings -- unless the user has opted into RStudio compatible keymaps.

This behavior should probably not be implemented in the Positron core but instead be implemented as an RStudio keymap extension.

https://code.visualstudio.com/docs/getstarted/keybindings#_keymap-extensions

This extension should be bundled with Positron and we'll probably also want some kind of way to activate it that is more obvious than VS Code's "load keymap" command.

@jmcphers jmcphers added this to the Public Beta milestone Jun 5, 2023
@jmcphers
Copy link
Collaborator Author

jmcphers commented Jun 7, 2023

Another common binding the RStudio keymap could override is F1, which shows the Command Palette in VS Code but brings up Help in RStudio.

@DavisVaughan
Copy link
Contributor

Option + Click and drag down for multiline cursor is also useful

@DavisVaughan
Copy link
Contributor

CMD + SHIFT + T for "Run tests", as attempted in #712 but we decided not to do it there because VS Code has an existing keybinding for this combination already

@DavisVaughan
Copy link
Contributor

CMD + SHIFT + N for "open a new R file" which should be easy now that we have r.createNewFile as a command

@jmcphers
Copy link
Collaborator Author

Another few based on #122 and #772:

  • Cmd Shift B - Build Package (VS Code binding: Run Build Task)
  • Cmd Shift L - Load Package (VS Code binding: Show Find Options)
  • Cmd Shift T - Test Package (VS Code binding: Previous Editor)
  • Cmd Shift E - Check Package (VS Code binding: Focus Explorer)

@juliasilge
Copy link
Contributor

juliasilge commented Jun 22, 2023

Plus Cmd Shift D - Document Package (VS Code binding: Show Run, i.e. workbench.view.debug)

These package development ones are probably the ones our earliest users will miss the most.

@isabelizimm
Copy link
Contributor

Adding in that a pipe keybinding would be nice as well!

@DavisVaughan
Copy link
Contributor

CTRL + . for some kind of "go to file / function" equivalent. Right now CMD + T will do "go to symbol in workspace" which is somewhat similar, and CMD + P will allow you to immediately type in a file name to go to

@jmcphers
Copy link
Collaborator Author

Another is Cmd Shift N, which opens a new window in VS Code but should open a new tab if RStudio bindings are active. https://positpbc.slack.com/archives/C05M2EZCPGR/p1695325876348719

@jmcphers
Copy link
Collaborator Author

Another is F2 which is Rename in VS Code but Go To Symbol in RStudio.

@juliasilge
Copy link
Contributor

In Positron 2024.01.0 (Universal) build 176, I can opt in to and then use the RStudio keymap:

keymap.mov

I think as part of #1487 we should improve how this setting is surfaced in the UI because that's kind of weird/awkward:

Screenshot 2024-01-22 at 11 21 15 AM

@wesm wesm added the area: core Issues related to Core category. label Feb 29, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: core Issues related to Core category.
Projects
None yet
Development

No branches or pull requests

5 participants