Published: March 11, 2022 • 2 min read
How does one create a new directory and file, without leaving Vim?
Assuming you’re running a shell, I would shell out for either of these
commands. Enter command mode with
ESC, and then:
:! touch new-file.txt :! mkdir new-directory
A great plugin for these actions is vim-eunuch, which gives you syntactic sugar for shell commands. Here’s the latter example, using vim-eunuch:
Here’s my original answer to this question on Stack Overflow.
✉️ Get better at programming by learning with me. Subscribe to Jake Worth's Newsletter for bi-weekly ideas, creations, and curated resources from across the world of programming. Join me today!
Blog of Jake Worth, software engineer in Maine.