If I invoke vim foo/bar/somefile but foo/bar don\'t already exist, Vim refuses to save.
vim foo/bar/somefile
foo/bar
I know I could switch to a shell or do :!mkdi
:!mkdi
I added this to my ~/.vimrc
cnoremap mk. !mkdir -p =expand("%:h")/
If I need to create the directory I'm in I type :mk. and it replaces that with "!mkdir -p /path/to/my/file/" and allows me to review the command before I invoke it.
:mk.