如何仅使用键在 vs 代码中的当前资源管理器目录中创建文件?

vkh*_*khv 6 visual-studio-code

就像在 vim nerd 树插件中一样,当您在 vim nerd 树中按“m”然后按“a”按钮时,您可以在当前目录中添加文件,光标位于书呆子树上。可以在 vs 代码中实现吗?也许一些插件?

dNi*_*tro 4

不幸的是,还没有这样的插件,但您可以定义一些自定义的键绑定,在某种程度上类似于 NERDTree(File > Preferences > Keyboard Shortcuts然后单击链接keybindings.json):

[
  {
    "key": "f",
    "command": "explorer.newFile",
    "when": "explorerViewletFocus && !inputFocus"
  },
  {
    "key": "d",
    "command": "explorer.newFolder",
    "when": "explorerViewletFocus && !inputFocus"
  },
  {
    "key": "x",
    "command": "deleteFile",
    "when": "explorerViewletFocus && !inputFocus"
  },
  {
    "key": "r",
    "command": "renameFile",
    "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
  },
  {
    "key": "enter",
    "command": "list.select",
    "when": "listFocus && !inputFocus"
  },
  {
    "key": "o",
    "command": "list.select",
    "when": "listFocus && !inputFocus"
  }
]
Run Code Online (Sandbox Code Playgroud)

您可以key自由更改 s,并且命令是不言自明的。我。e:f在资源管理器中点击将在选定的目录中添加一个文件......)。

幸运的是,我们还可以通过vscodevimj插件在资源管理器中进行操作。k

唯一缺少的部分是搜索树;当然,我们承诺在 2019 年 1 月之前添加(请参阅问题 #10026