You can yes. Given the nature of these selectors (they need to be executed via the command palette to show the list), it will be slightly different from the direct command palette entry in .sublime-commands
. Basically you need to execute the git
command via the show_command_palette
command to get the same effect as directly adding it to the command palette
Go to your user key bindings by navigating to Preferences -> Edit Key Bindings ...
from the main menu. There paste the following.
{
"keys": ["ctrl+b"],
"command": "show_command_palette",
"args": {
"command": "git",
"args": {"argv": ["switch", "$select_branch"]},
"description": "Switch Branch",
},
}
This should then show the same command palette UI for picking a branch to switch to (same as your command palette entry).
The only thing I fail to understand is why the description
arg is not working. That arg is used for showing an InputHandler
label description. In your command palette entry case, it would be Switch Branch
. Here it is somehow Git
because it fails (?). The functionality should still work though.