目标:通过Explorer VS Code 视图查看项目中的大量文件。
这是一个有点长(但易于理解)的过程 - 但是一旦完成,您以后会节省很多时间。
1 .安装multi-command扩展
https://marketplace.visualstudio.com/items?itemName=ryuta46.multi-command
2 。菜单 > 文件 > 首选项 > 设置
或者,Ctrl + ,
3 .点击右上角的“打开设置(JSON)”按钮
4 。粘贴在下面:
"multiCommand.commands": [
{
"command": "multiCommand.navigateExplorerDownAndPreviewFile",
"sequence": ["list.focusDown", "filesExplorer.openFilePreserveFocus"]
},
{
"command": "multiCommand.navigateExplorerUpAndPreviewFile",
"sequence": ["list.focusUp", "filesExplorer.openFilePreserveFocus"]
}
],
5 .菜单 > 文件 > 首选项 > 键盘快捷键
或者,Ctrl K + Ctrl S
6 .点击右上角的Open Keyboard Shortcuts JSON按钮
7 .将以下两个条目粘贴到您的数组中
[
{
"key": "down",
"command": "multiCommand.navigateExplorerDownAndPreviewFile",
"when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && listFocus && !inputFocus"
},
{
"key": "up",
"command": "multiCommand.navigateExplorerUpAndPreviewFile",
"when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && listFocus && !inputFocus"
}
]
8 .菜单 > 视图 > 资源管理器
或者,Ctrl Shift E
9 .在资源管理器中选择左侧的任何文件
您可以打开一个包含多个文件的文件夹(例如,.js 文件)
10 .尝试使用以下键盘快捷键打开下一个/上一个文件
- 按
up arrow 转到上一个文件,并在中间窗格中查看它
- 按
down arrow 转到下一个文件,并在中间窗格中查看它
现在,您已设置为仅使用 up 和 down 箭头键,通过 vs 代码中的资源管理器预览文件。