diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-12-30 09:58:20 +0100 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-12-30 09:58:20 +0100 |
commit | e5668602cc89f3298a1ab936b082e82519aa6a50 (patch) | |
tree | fd74b8b491d30525f1a63b72ea441e35675b109a | |
parent | 6783bd0df98094539c752e3281035e1b92d6af69 (diff) | |
download | vim-polyglot-e5668602cc89f3298a1ab936b082e82519aa6a50.tar.gz vim-polyglot-e5668602cc89f3298a1ab936b082e82519aa6a50.zip |
Enable again swapfiles, fixes #638
-rw-r--r-- | ftdetect/polyglot.vim | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 4d6935fe..29a4a2c7 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -2687,8 +2687,25 @@ if !has_key(g:polyglot_is_disabled, 'sensible') " Reload unchanged files automatically. set autoread - " Disable swap, it doesn't play well with autoread - set noswapfile + " This is needed to avoid swapfile warning when auto-reloading + set shortmess+=A + + " Avoids swapfiles in current directory + if &directory =~# '^\.,' + if !empty($HOME) + if has('win32') + let &directory = expand('$HOME/vimfiles') . '//,' . &directory + else + let &directory = expand('$HOME/.vim') . '//,' . &directory + endif + endif + if !empty($XDG_DATA_HOME) + let &directory = expand('$XDG_DATA_HOME') . '//,' . &directory + endif + if has('macunix') + let &directory = expand('$HOME/Library/Autosave Information') . '//,' . &directory + endif + endif " Autoindent when starting new line, or using `o` or `O`. set autoindent |