From 8981f684bb6ea9c87a5fda20196cdccc3e13eb2e Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Wed, 30 Nov 2016 10:31:50 +0530 Subject: [PATCH 1/1] 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'). --- .vimrc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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 -- 2.39.2