vscode 添加新建文件夹快捷键 (配置 when 属性)

实现目标

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

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

下面是官方文档配置快捷键的地址
https://code.visualstudio.com/docs/getstarted/keybindings

相应步骤

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

    image

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

    image

  3. 在KeyBoard Shortcuts视图里, 有一个打开keybindings.json文件的链接, 点击可以打开该文件,
    image
    此时我们可以看到右侧文件的相应配置, 这就是我们刚刚配置的东西. 我们可以参照左边的格式配置 when 属性, 可是我们该怎么选择属性呢.
    image

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

    现在我们可以打开 Vs code 的官方文档 Key Bindings for Visual Studio 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 language ID 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
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

逆光影者

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值