Create a New File or Directory Inside Vim

Topic: VIM

Published on

When I’m working in Vim, I normally quit to create any directories or files. Turns out it’s straightforward to create a file or directory 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:

:! mkdir app/Models

To create a new file:

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

References