diff --git a/vim/.config/vim/init.d/xdg.vim b/vim/.config/vim/init.d/xdg.vim index 1baf246..b7fa5fa 100644 --- a/vim/.config/vim/init.d/xdg.vim +++ b/vim/.config/vim/init.d/xdg.vim @@ -9,12 +9,31 @@ set runtimepath+=$XDG_CONFIG_HOME/vim/after set runtimepath+=$XDG_DATA_HOME/vim set packpath^=$XDG_DATA_HOME/vim -call mkdir($XDG_DATA_HOME.'/vim/spell', 'p', 0700) -set backupdir=$XDG_CACHE_HOME/vim/backup// | call mkdir(&backupdir, 'p', 0700) -set directory=$XDG_CACHE_HOME/vim/swap// | call mkdir(&directory, 'p', 0700) -set undodir=$XDG_CACHE_HOME/vim/undo// | call mkdir(&undodir, 'p', 0700) -set viewdir=$XDG_CACHE_HOME/vim/view// | call mkdir(&viewdir, 'p', 0700) +if !isdirectory($XDG_DATA_HOME.'/vim/spell') + call mkdir($XDG_DATA_HOME.'/vim/spell', 'p', 0700) +endif + +set backupdir=$XDG_CACHE_HOME/vim/backup/ +set directory=$XDG_CACHE_HOME/vim/swap/ +set undodir=$XDG_CACHE_HOME/vim/undo/ +set viewdir=$XDG_CACHE_HOME/vim/view/ + +if !isdirectory(&backupdir) + call mkdir(&backupdir, 'p', 0700) +endif + +if !isdirectory(&directory) + call mkdir(&directory, 'p', 0700) +endif + +if !isdirectory(&undodir) + call mkdir(&undodir, 'p', 0700) +endif + +if !isdirectory(&viewdir) + call mkdir(&viewdir, 'p', 0700) +endif if !has('nvim') set viminfofile=$XDG_CACHE_HOME/vim/viminfo