From 18f95ebbbf24e42192e380fc026e1dab038a2e9a Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 27 Jul 2012 02:59:40 +0200 Subject: [PATCH] vimrc: Only remove . from 'directory' if safe directories are available. --- vimrc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 -- 2.44.1