In VS Code, when the source control view is focused, I want to focus the first file in "staged Changes", navigate and focus between them, is there a keyboard shortcut to do this?
I want the behavior works like "Search: Focus Next Search Result,Search: Focus Previous Search Result". but in source view stage section
You can do this directly from anywhere in the scm view, but you will need a macro extension like Multi-Command. And this keybinding:
{
"key": "alt+u", // whatever keybinding you want
"command": "extension.multiCommand.execute",
"args": {
"sequence": [
"list.focusFirst", // focuses the commit message input, as close as you can get
"list.focusDown",
"list.focusDown",
"list.focusDown",
"list.select" // add this to also open the scm diff
],
},
"when": "focusedView == workbench.scm"
}
When you are focused in the scm view you could go down/up a file and focus it with this keybinding:
{
"key": "alt+down", // whatever keybinding you want
"command": "extension.multiCommand.execute",
"args": {
"sequence": [
"list.focusDown", // or "list.focusUp"
"list.select"
],
},
"when": "focusedView == workbench.scm"
}
To open the next item in the scm view and return focus to that scm view, try this keybinding:
{
"key": "alt+down", // whatever keybinding you want
"command": "extension.multiCommand.execute",
"args": {
"interval": 400, // need a delay
"sequence": [
"list.focusDown",
"list.select",
"workbench.action.focusSideBar",
],
},
"when": "focusedView == workbench.scm"
}