]> git.phdru.name Git - dotfiles.git/commitdiff
Set directory for swap files to ~/tmp/vim
authorOleg Broytman <phd@phdru.name>
Wed, 30 Nov 2016 05:01:50 +0000 (10:31 +0530)
committerOleg Broytman <phd@phdru.name>
Wed, 30 Nov 2016 05:10:08 +0000 (10:40 +0530)
Create the directory (and the directory for undo files)
if they don't exist. Use mkdir() instead of system('mkdir').

.vimrc

diff --git a/.vimrc b/.vimrc
index 745587a5e393214248f73fe86e1bf5a61a42bc26..e0b32985a97dc55725f81739576987702b045bec 100644 (file)
--- 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