繁体   English   中英

在 VScode 中使用箭头键导航文件资源管理器时立即打开文件

[英]Instantly open files when navigating the file explorer with arrow keys in VScode

目前,我使用箭头键在VScode 中导航文件树,并且必须按Cmd + Down才能在编辑器中显示文件。

有没有办法在VScode 中浏览文件资源管理器并在没有快捷方式的情况下在焦点/突出显示时立即打开文件? (类似于它在崇高文本中的工作方式)

正如此 github 问题中所写:(在资源管理器中使用键盘导航时打开文件预览以获得更好的可访问性。#55816) ,截至(至少)2019 年 8 月 28 日,可以

预览文件,通过在资源管理器中使用向上/向下选择它们并按空格

可以使用shift + cmd + E轻松切换到文件浏览器。 这不仅仅是箭头键那么简单,但仍然比问题中描述的更方便。

目标:Glace 通过 VS Code 的Explorer视图查看项目中的大量文件。

这是一个有点长(但易于遵循)的过程 - 但一旦完成,您将在以后节省大量时间。


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转到下一个文件,并在中间窗格中查看

现在,您可以通过 vs 代码中的资源管理器仅使用updown箭头键来预览文件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM