Skip to content

Create a new file or directory inside Vim


Typically when I’m working in Vim, I’ll quit to create any directories or files. Turns out it’s relatively straightforward to create a directory or file while inside the editor.

The easiest way would to be to shell out to the command line using the bang ! operator.

For example to create a new directory, you could do:

:! mkdir app/Models

To create a new file, you could do:

:! touch app/Http/Controllers/UserController.php


See more stuff that I've learned


Leave a reply

Required fields denoted by *

Your comment will be revised by the site if needed.