" 強制書き込み cabbr w!! w !sudo tee > /dev/null % " 自動mkdir function! s:auto_mkdir(dir, force) abort if !isdirectory(a:dir) && (a:force || \ input(printf('"%s" does not exist. Create? [y/N]', a:dir)) =~? '^y\%[es]$') call mkdir(iconv(a:dir, &encoding, &termencoding), 'p') endif endfunction augroup VimrcAutoMakedir autocmd! autocmd BufWritePre * call s:auto_mkdir(expand(':p:h'), v:cmdbang) augroup END