VS Code - Add a new file under the selected working directory

后端 未结 4 519
猫巷女王i
猫巷女王i 2021-01-29 21:38

I\'m trying to get a shortcut to add a new file under my current working folder. So I navigate to the explorer using cmd+shift+e and when I get to the folder I want

4条回答
  •  迷失自我
    2021-01-29 22:10

    To add files or folders add the following lines to keybindings.json:

    Updated answer on 2020/02/10 (Thanks to @AbrahamHernandez, who provided the comment).

    [
      { "key": "ctrl+n",
        "command": "explorer.newFile",
        "when": "!editorFocus" },
    
      { "key": "ctrl+shift+n",
        "command": "explorer.newFolder",
        "when": "!editorFocus" }
    ]
    

    These bindings are active if the editor is not focused.

    They are also triggered if the debug window is active. That's not perfect but the context explorerFocus is going to be added in the near future: see GitHub

提交回复
热议问题