From: Oleg Broytman Date: Wed, 30 Nov 2016 05:01:50 +0000 (+0530) Subject: Set directory for swap files to ~/tmp/vim X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=8981f684bb6ea9c87a5fda20196cdccc3e13eb2e;p=dotfiles.git Set directory for swap files to ~/tmp/vim Create the directory (and the directory for undo files) if they don't exist. Use mkdir() instead of system('mkdir'). --- diff --git a/.vimrc b/.vimrc index 745587a..e0b3298 100644 --- a/.vimrc +++ b/.vimrc @@ -125,9 +125,15 @@ endif " 20 the swap file +let myUndoDir = expand('~/tmp/vim/undo') +if !isdirectory(myUndoDir) + " Create dirs + call mkdir(myUndoDir, 'p') +endif + " list of directories for the swap file; remove . (the current directory) if has("win32") - set directory=$TEMP//,c:/tmp//,c:/temp// + set directory=~/tmp/vim//,$TEMP//,c:/tmp//,c:/temp// else set directory=~/tmp/vim//,~/tmp//,/var/tmp//,/tmp// endif @@ -146,9 +152,6 @@ set wildmode=longest,list:longest,full " Bash-vim completion behavior " Keep undo history across sessions by storing it in a file if has('persistent_undo') - let myUndoDir = expand('$HOME/tmp/vim/undo') - " Create dirs - call system('mkdir -p ' . myUndoDir) let &undodir = myUndoDir set undofile endif