Ad blocker interference detected!
Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers
Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.
When opening a new file with
:split, you may want to create the directory the file will reside in. This can be done in autocommand BufNewFile (add to vimrc in any Unix-like system with mkdir that accepts -p switch).
au BufNewFile * :exe ': !mkdir -p ' . escape(fnamemodify(bufname('%'),':p:h'),'#% \\')
This tip is rather dodgy for those of us who sometimes make mistakes. I don't think it should automatically create possibly several directories as a result of a simple typo in the
:edit /path/file command.
The tip should instead provide a specific command to create a path and edit a file (you would know that using the command may create unwanted directories if you made a typo).
I believe that the md/mkdir in any Windows with cmd.exe (possibly not NT4) will make intermediate directories without needing
-p or any other option.