From: Simon Ruderich Date: Fri, 27 Jul 2012 00:59:40 +0000 (+0200) Subject: vimrc: Only remove . from 'directory' if safe directories are available. X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=18f95ebbbf24e42192e380fc026e1dab038a2e9a;p=config%2Fdotfiles.git vimrc: Only remove . from 'directory' if safe directories are available. --- diff --git a/vimrc b/vimrc index 41dd812..50c6b70 100644 --- 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