Adds more modular setup
This commit is contained in:
parent
7633efd06c
commit
d5a8a364dd
5 changed files with 71 additions and 0 deletions
11
vim/auto-mkdir.vim
Normal file
11
vim/auto-mkdir.vim
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
augroup vimrc-auto-mkdir
|
||||
autocmd!
|
||||
autocmd BufWritePre * call s:auto_mkdir(expand('<afile>:p:h'), v:cmdbang)
|
||||
function! s:auto_mkdir(dir, force)
|
||||
if !isdirectory(a:dir)
|
||||
\ && (a:force
|
||||
\ || input("'" . a:dir . "' does not exist. Create? [y/N]") =~? '^y\%[es]$')
|
||||
call mkdir(iconv(a:dir, &encoding, &termencoding), 'p')
|
||||
endif
|
||||
endfunction
|
||||
augroup END
|
||||
Loading…
Add table
Add a link
Reference in a new issue