[英]VSCode open workspace folder hotkey
I am wondering if there is a way I could bind a keyboard shortcut to open the OS File Explorer at the root workspace directory. 我想知道是否有一种方法可以绑定键盘快捷方式来打开根工作区目录中的OS文件资源管理器。
Furthermore, I would also like to be able to open a specific folder, relative to my workspace path, with the press of a keyboard shortcut. 此外,我还希望能够通过按键盘快捷键打开相对于我的工作区路径的特定文件夹。
I have search through the settings file, and for extensions, but I didn't come up with anything yet. 我已经搜索了设置文件和扩展,但我还没有想出任何东西。
One way to accomplish this would be by using a task and a keybinding . 实现此目的的一种方法是使用任务和键绑定 。
Workspace Folder 工作区文件夹
To open the workspace using shift ctrl alt + t , create a task: 要使用shift ctrl alt + t打开工作区,请创建一个任务:
tasks.json tasks.json
{
"label": "explore workspace",
"type": "shell",
"windows": {
"command": "explorer ${workspaceFolder}"
},
"osx": {
"command": "open ${workspaceFolder}"
}
}
Note the task label. 注意任务标签。 Ad a corresponding keybinding:
广告相应的键绑定:
keybindings.json keybindings.json
{
"key": "ctrl+shift+alt+t",
"command": "workbench.action.tasks.runTask",
"args": "explore workspace"
}
Note the args
value matches the task's label
value. 请注意,
args
值与任务的label
值匹配。
Folder relative to workspace 文件夹相对于工作区
Assume you want to open ${workspaceFolder}/node_modules/.bin
. 假设您要打开
${workspaceFolder}/node_modules/.bin
。 Add the task: 添加任务:
{
"label": "explore bin",
"type": "shell",
"windows": {
"command": "explorer ${workspaceFolder}\\node_modules\\.bin"
},
"osx": {
"command": "open ${workspaceFolder}/node_modules/.bin"
}
}
and a corresponding keybinding: 和相应的键绑定:
{
"key": "ctrl+shift+alt+r",
"command": "workbench.action.tasks.runTask",
"args": "explore bin"
}
Disclaimer : Only tested on Windows 免责声明 :仅在Windows上测试过
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.