Reputation: 96304
I'd like to trigger a command listed in the Default Keybindings
view from the Command Palette.
For example, I'd like to be able to trigger one of commands listed below, by name (or a string alias of my choice), from the Command Palette (Command + Shift + P
).
How do I do that?
// ---- From "Default Keybindings" -----
//
...
// - workbench.extensions.action.showExtensionsWithIds
// - workbench.extensions.action.showInstalledExtensions
// - workbench.extensions.action.showLanguageExtensions
// - workbench.extensions.action.showPopularExtensions
// - workbench.extensions.action.showRecommendedExtensions
// - workbench.extensions.action.stopExtensionHostProfile
// - workbench.extensions.action.updateAllExtensions
// - workbench.extensions.installMissingDepenencies
// - workbench.files.action.acceptLocalChanges
// - workbench.files.action.collapseExplorerFolders
// - workbench.files.action.compareFileWith
// - workbench.files.action.focusFilesExplorer
// - workbench.files.action.refreshFilesExplorer
// - workbench.files.action.revertLocalChanges
// - workbench.files.action.saveAllInGroup
// - workbench.files.action.showActiveFileInExplorer
// - workbench.output.action.clearOutput
// - workbench.userData.actions.continueSync
// - workbench.userData.actions.login
// - workbench.userData.actions.logout
// - workbench.userData.actions.stopSync
// - workbench.userData.actions.syncStart
// - workbench.view.extension.atlascode-drawer
// - workbench.view.extension.databaseExplorer
// - workbench.view.extension.gitlens
// - workbench.view.extension.references-view
// - workbench.view.extension.test
// - workbench.view.remote
// - workbench.view.search.focus
...
Upvotes: 5
Views: 187
Reputation: 181339
The Default Keybindings
listing does not show the title of each command as it appears in the Command Palette. You would typically use that title/alias to search in the Command Palette. Using the plain command, like workbench.extensions.action.showLanguageExtensions
is a pain because you need to type the whole command out exactly right for it to be found in the Command Palette.
You could also put the command into the KeyBoard Shortcuts
search to learn its built-in alias.
There is no way at present - but it is on the backlog - see https://github.com/microsoft/vscode/issues/50836 - to be able to make your own aliases for commands.
However, I wrote an extension to do this that is in preview, command alias that allows you to create your own aliases for commands. For example:
"command aliases": {
"explorer.newFile": "touch",
"explorer.newFolder": "mkdir"
},
would give you a touch
and a mkdir
listing/alias right in the Command Palette that would trigger explorer.newFile
and explorer.newFolder
respectively.
Upvotes: 3