admin管理员组

文章数量:1516870

实现目标

在获取左侧项目栏文件夹焦点情况下 添加新建文件夹的快捷键 Shift + A

我本来是个atom忠实粉丝, 但是atom使用window10自带输入法在书写汉字时总是会出现首字母缺失的情况, 查了好久没法解决, 直接放弃了atom, 转而使用Vs code书写markdown,
但是使用Vs code时发现在左侧导航栏配置新建文件和文件夹没有快捷方式, 于是就想配置一个, 但是在百度上搜了好长时间, 却总是解决不了KeyBoard Shortcuts上面的when 属性, 最终访问的 Vs code 官方文档 解决的.

下面是官方文档配置快捷键的地址

相应步骤

  1. 点击左下角设置图标, 点击其中的选项KeyBoard Shortcuts.

  2. 输入 “explorer.new” 找到相应命令, 点击 explorer.newFolder 行配置上 “Shift + A”, 快捷键. 但是这里还有个 When 属性, 如果放任不管的话, 软件会默认全局快捷键, 试想一下, 在你编辑的时候突然按了个 “Shift + A”, 结果新建了个文件夹, 那真是太糟糕了, 所以 When 属性一定要解决.

  3. 在KeyBoard Shortcuts视图里, 有一个打开keybindings.json文件的链接, 点击可以打开该文件,

    此时我们可以看到右侧文件的相应配置, 这就是我们刚刚配置的东西. 我们可以参照左边的格式配置 when 属性, 可是我们该怎么选择属性呢.

  4. 找到符合条件的When属性

    现在我们可以打开 Vs code 的官方文档 ,这个是国外的网站, 纯英文. 可能打不开, 下面贴上文档里的关于 When 的介绍, 里面也是英文的, 不过作为使用Vs code的开发人员, 这点应该能看懂的, 实在不行也可以google翻译.

    Context name True when
    Editor contexts
    editorFocus An editor has focus, either the text or a widget.
    editorTextFocus The text in an editor has focus (cursor is blinking).
    textInputFocus Any editor has focus (regular editor, debug REPL, etc.).
    inputFocus Any text input area has focus (editors or text boxes).
    editorHasSelection Text is selected in the editor.
    editorHasMultipleSelections Multiple regions of text are selected (multiple cursors).
    editorReadonly The editor is read only.
    editorLangId True when the editor’s associated matches. Example: "editorLangId == typescript" .
    isInDiffEditor The active editor is a difference editor.
    isInEmbeddedEditor True when the focus is inside an embedded editor.
    Operating system contexts
    isLinux True when the OS is Linux
    isMac True when the OS is ma

本文标签: 属性捷键系统