Better (?) location for transient files

Closes #22.
This commit is contained in:
Tim Pope
2013-01-20 11:24:25 -05:00
parent 6083bf4a61
commit 6c1ed9b043
2 changed files with 9 additions and 7 deletions

View File

@@ -60,15 +60,16 @@ if &history < 1000
endif
set viminfo^=!
if isdirectory(expand('~/.cache/vim'))
let s:dir = has('win32') ? '~/Application Data/Vim' : has('mac') ? '~/Library/Vim' : '~/.local/share/vim'
if isdirectory(expand(s:dir))
if &directory =~# '^\.,'
set directory^=~/.cache/vim/swap//
let &directory = s:dir . '/swap//,'
endif
if &backupdir =~# '^\.,'
set backupdir^=~/.cache/vim/backup//
let &backupdir = s:dir . '/backup//,'
endif
if exists('+undodir') && &undodir =~# '^\.\%(,\|$\)'
set undodir^=~/.cache/vim/undo//
let &undodir = s:dir . '/undo//,'
endif
endif
if exists('+undofile')