Create new files and directories quickly using the command palette.
Install from Visual Studio Marketplace
Inspired by the awesome AdvancedNewFile extension for Sublime Text.
- Press the hotkey: Cmd+Alt+N on Mac or Ctrl+Alt+N on Windows.
- Type a path to a file or a folder you want to create, relative to the currently open file.
- Press Enter.
Creates all the necessary nested folders, and opens the created file in the editor:
To create a folder, append /
on a Mac or \
on Windows to the path. For example, taco/cat/
:
To go up the file tree, start the path with ../
on a Mac or ..\
on Windows. For example, ../tacocat.txt
:
To create a file or folder in the workspace root, start the path with /
on a Mac or \
on Windows. For example, /tacocat.txt
:
You can redefine the key bindings:
Description | Name | Default Mac | Default Windows |
---|---|---|---|
Create new file | newFileNow.createNewFile |
Cmd+Alt+N | Ctrl+Alt+N |
The changelog can be found on the Changelog.md file.
There are plenty of similar extensions (like this or this) but they are either broken, or confusing. I wanted something that’s easy to use, efficient, simple, and has great UX. Also, they weren’t updated in years and don’t use new Visual Studio Code’s APIs.
Visual Studio Code has several options to create new files:
- File → New Text File (Cmd+N): creates an anonymous file, to save it you’d need to use the system file dialog and create all the folders manually.
- File → New File (Cmd+Ctrl+Alt+N): shows a similar to the New File Now quick picker dialog, but it has a confusing UX because it’s unclear where the new file is going to be created, and it opens a system file dialog on the next step, which is even more confusing…
explorer.newFile
(no key binding by default): creates a new file in the current folder, supports nesting and creating folders. This is close but the UX is still not as good for my taste.
All these methods are confusing and unproductive, and don’t give the user enough clarity on what’s going to happen. Most don’t create folders, don’t respect the folder of the currently open file, or dot’t let you go up. The New File Now extension doesn’t have these issues.
Check out my other Visual Studio Code extensions:
- Just Blame: Git Blame annotations, inspired by JetBrains editors
- Emoji Console Log: insert `console.command palette
- Mini Markdown: minimalist kit for comfortable Markdown writing
- Notebox: take quick notes in the bottom panel
- Todo Tomorrow: highlight
TODO
,HACK
,FIXME
, etc. comments - Squirrelsong Light Theme: low contrast non-distracting light theme for web developers
- Squirrelsong Dark Theme: low contrast non-distracting dark theme for web developers
This software has been developed with lots of coffee, buy me one more cup to keep it going.
Bug fixes are welcome, but not new features. Please take a moment to review the contributing guidelines.
Artem Sapegin, and contributors.
MIT License, see the included License.md file.