]> ruderich.org/simon Gitweb - config/dotfiles.git/blobdiff - vimrc
vimrc: Always use unix line-endings for new files.
[config/dotfiles.git] / vimrc
diff --git a/vimrc b/vimrc
index 41dd8124b00fe1846168383d45a8b32f7f11cad7..7df6365182611242b13b9de9edc4a4ad4e24b202 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
 
@@ -117,6 +120,9 @@ endif
 " existing files.
 set fileencodings=utf-8,latin1
 
+" Always use unix line-endings for new files.
+set fileformats=unix,dos
+
 " Wrap text after 78 characters.
 set textwidth=78