]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
vimrc: Only remove . from 'directory' if safe directories are available.
authorSimon Ruderich <simon@ruderich.org>
Fri, 27 Jul 2012 00:59:40 +0000 (02:59 +0200)
committerSimon Ruderich <simon@ruderich.org>
Fri, 27 Jul 2012 00:59:40 +0000 (02:59 +0200)
vimrc

diff --git a/vimrc b/vimrc
index 41dd8124b00fe1846168383d45a8b32f7f11cad7..50c6b70ef316dd981abf86e5281639c5d061510f 100644 (file)
--- a/vimrc
+++ b/vimrc
@@ -49,8 +49,11 @@ set encoding=utf-8
 set runtimepath-=~/.vim
 set runtimepath^=~/.vim,~/.vim/runtime
 
-" Don't store swap files in the same directory as the edited file.
-set directory-=.
+" Don't store swap files in the same directory as the edited file. But only if
+" we have a "safe" writable directory available.
+if filewritable('~/.tmp') == 2 || filewritable('~/tmp') == 2
+    set directory-=.
+endif
 " But store them in ~/.tmp or ~/tmp (already set by default) if available.
 set directory^=~/.tmp