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

References


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *