Skip to content

Instantly share code, notes, and snippets.

@soh335
Created December 17, 2009 09:18
Show Gist options
  • Save soh335/258641 to your computer and use it in GitHub Desktop.
Save soh335/258641 to your computer and use it in GitHub Desktop.
function! s:CreateDirAndWrite()
let dir = expand("%:p:h")
if isdirectory(dir) == 0
call mkdir(dir, "p")
endif
execute ':w'
endfunction
command! CreateDirAndWrite :call s:CreateDirAndWrite()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment