In vim its easy to
:saveas a file to a path that doesn't yet exist. Such as:
Vim will let you have a buffer with that path, but when you try to write the file vim will throw an error:
E212: Can't open file for writing
Mkdir! command. The
Mkdir command has been added by the eunuch.vim plugin to make creating directories easier from vim. The bang (!) variant takes the path of the current buffer and creates the directory from that path.
When we get the E212 error we can type:
And walla! The path will be created. No more errors when writing the file.Tweet