VS Code shortcut to stage changes in toggled elements of list

465 Views Asked by At

I would like to add a shortcut to stage changes in all files "toggled" in the SCM pane of VS Code. The behavior should be the same as if I clicked on the plus icon of a particular file having multiple files toggled (see picture):

enter image description here

I have set the following keybinding so far:

{
    "key": "cmd+enter",
    "command": "git.stage",
    "when": "listFocus && sideBarFocus && activeViewlet == 'workbench.view.scm'"
}

This does not work properly. It stages only a file that was in the last focused editor, ignoring the selection made in Changes.

Any ideas on how I could fix my 'when' to make it work?

Just for context, I would like to be able to stage a selected list of files in Change using only the keyboard.

Thanks!

1

There are 1 best solutions below

1
On

I found a way of doing it only by using keyboard, but it require few more steps:

  1. Shift + ctrl +g ,g -> to focus on SCM window

  2. Then holding shift select files with arrows

  3. Then press tab , you should see highlight like below: enter image description here

  4. Then you can move to + button with right arrow and press enter: enter image description here