aboutsummaryrefslogtreecommitdiff
path: root/plugin/write_mkpath.vim
blob: 4a47d705c8b816343c8443c92047188efc0b260f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
"
" write_mkpath: If :write! is issued for a file that has nonexistent path
" elements, create the full path with mkdir() before saving.
"
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
"  
if exists('loaded_write_mkpath') || &compatible || v:version < 700
  finish
endif

" Check path to every file before it's saved
augroup write_mkpath
  autocmd!
  autocmd BufWritePre *
        \ call write_mkpath#(expand('<afile>:p:h'))
augroup END