diff options
Diffstat (limited to 'autoload/write_mkpath.vim')
-rw-r--r-- | autoload/write_mkpath.vim | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/autoload/write_mkpath.vim b/autoload/write_mkpath.vim index cba56e9..95fab08 100644 --- a/autoload/write_mkpath.vim +++ b/autoload/write_mkpath.vim @@ -21,11 +21,14 @@ function! write_mkpath#(path) abort let mkpath = 0 endif - " If we decided to attempt a path creation, do so - if mkpath - call mkdir(dir, 'p') + " Stop here if we're not creating a path + if !mkpath + return endif + " Create the full required path + call mkdir(dir, 'p') + " Prod Vim into realising the buffer's directory exists now, so that a " subsequent change of working directory doesn't break it silent keepalt file % |