Skip to content

Instantly share code, notes, and snippets.

@noid11
Created May 17, 2017 14:40
Show Gist options
  • Save noid11/680adc1f06475f563ef93682f8198874 to your computer and use it in GitHub Desktop.
Save noid11/680adc1f06475f563ef93682f8198874 to your computer and use it in GitHub Desktop.
vim でファイル保存時にディレクトリを生成する設定
augroup vimrc-auto-mkdir " {{{
autocmd!
autocmd BufWritePre * call s:auto_mkdir(expand('<afile>:p:h'))
function! s:auto_mkdir(dir) " {{{
if !isdirectory(a:dir)
call mkdir(iconv(a:dir, &encoding, &termencoding), 'p')
endif
endfunction " }}}
augroup END " }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment