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 default keybindings for stage/revert/unstage selected ranges #93706

Merged
merged 2 commits into from Apr 9, 2020

Conversation

ChrisPapp
Copy link
Contributor

This PR fixes #93564

Created default keybindings for the following commands

Git: Stage Selected Ranges -> ctrl + k, ctrl + alt + s
Git: Unstage Selected Ranges -> ctrl + k, ctrl + u
Git: Revert Selected Ranges -> ctrl + k, ctrl + r

Screenshot (217)

Note:
ctrl + k, ctrl + u is also used by "Remove Line Comment". "Unstage Selected Ranges" now overrides it, however similar functionality can be achieved by using "Toggle Line Comment" (ctrl + /)

git.stageSelectedRanges   -> ctrl + k, ctrl + alt + s
git.unstageSelectedRanges -> ctrl + k, ctrl + u
git.revertSelectedRanges  -> ctrl + k, ctrl + r

Closes microsoft#93564
@msftclas
Copy link

msftclas commented Mar 30, 2020

CLA assistant check
All CLA requirements met.

@@ -411,6 +411,23 @@
"category": "Git"
}
],
"keybindings": [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add mac keybindings to use cmd instead of ctrl.
Example how markdown does it

@isidorn
Copy link
Contributor

isidorn commented Mar 30, 2020

@ChrisPapp Thanks for creating a PR for this. I have left a comment in the code which you should tackle for now.
@joaomoreno is back from vacation so he can also review and decide if he wants this. He has a lot of issues on his plate now that is back, so you might have to wait a bit until he reviews. However there is no hurry with this, we should either way do it in our April milesonte

@joaomoreno
Copy link
Member

@isidorn Please take over this.

@joaomoreno joaomoreno removed their assignment Mar 31, 2020
@isidorn
Copy link
Contributor

isidorn commented Apr 1, 2020

@ChrisPapp assigning this to April, which means we will merge it starting of next week. Can you please tackle my comment until then? Thanks

@isidorn isidorn added this to the April 2020 milestone Apr 1, 2020
Use command key instead of ctrl on Mac
@ChrisPapp ChrisPapp requested a review from isidorn April 1, 2020 18:00
@ChrisPapp
Copy link
Contributor Author

@isidorn
Ok, I added the keybindings for Mac. In case you haven't already, please check my comment on the issue thread, because there may be a problem with one of the keybindings.

#93564 (comment)

@isidorn
Copy link
Contributor

isidorn commented Apr 2, 2020

That conflict is fine. All keybindins are taken in vscode you have to have some conflicts. Thanks for adding keybinding for mac, I will checkout the PR next week.

Copy link
Contributor

@sportshead sportshead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment

{
"command": "git.revertSelectedRanges",
"key": "ctrl+k ctrl+r",
"mac": "cmd+k cmd+r",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"mac": "cmd+k cmd+r",
"mac": "cmd+k cmd+alt+r",

macOS VS Code has CmdK CmdR as a builtin keyboard shortcut that opens this link: https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf
I don't know about Linux and windows, but best not to conflict.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps if we do use alt, probably best to change revert for more uniformity?

@isidorn
Copy link
Contributor

isidorn commented Apr 9, 2020

Good job with this PR, let's go with these keybdingins and we'll see if we should change them due to conflicts.

@isidorn isidorn merged commit 7191302 into microsoft:master Apr 9, 2020
@github-actions github-actions bot locked and limited conversation to collaborators May 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Git: add default keybinding for Stage / Revert / Unstage selected lines
5 participants