Created
May 17, 2017 14:40
-
-
Save noid11/680adc1f06475f563ef93682f8198874 to your computer and use it in GitHub Desktop.
vim でファイル保存時にディレクトリを生成する設定
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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