我想从命令面板触发Default Keybindings
视图中列出的命令。
例如,我希望能够从命令面板中触发按名称(或我选择的字符串别名)下面列出的命令之一。 >(Command + Shift + P
)。
我该怎么做?
// ---- 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
...
答案 0 :(得分:2)
Default Keybindings
列表未显示每个命令的标题,因为它显示在命令面板中。通常,您将使用该标题/别名在命令面板中进行搜索。使用workbench.extensions.action.showLanguageExtensions
之类的普通命令很麻烦,因为您需要正确键入整个命令才能在命令面板中找到它。
您还可以将命令放入KeyBoard Shortcuts
搜索中以了解其内置别名。
目前尚无办法-但它处于待办事项中-参见https://github.com/microsoft/vscode/issues/50836-能够为命令创建自己的别名。
但是,我编写了一个扩展来执行此操作,该扩展处于预览状态command alias中,可让您为命令创建自己的别名。例如:
"command aliases": {
"explorer.newFile": "touch",
"explorer.newFolder": "mkdir"
},
将在命令面板中给您touch
和mkdir
列表/别名,分别触发explorer.newFile
和explorer.newFolder
。