Use XDG for swap and backup as well, plus ensure that XDG cache dirs are created
This commit is contained in:
parent
405bea7ea4
commit
8b15560413
1 changed files with 13 additions and 4 deletions
|
@ -8,6 +8,12 @@ if !filereadable($XDG_CACHE_HOME . '/vim/autoload/plug.vim')
|
||||||
augroup END
|
augroup END
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
function s:ensure_dir(dir)
|
||||||
|
if filewritable(a:dir) != 2
|
||||||
|
call mkdir(a:dir, "p", 0700)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
call plug#begin($XDG_CACHE_HOME . '/vim/bundle')
|
call plug#begin($XDG_CACHE_HOME . '/vim/bundle')
|
||||||
Plug 'tpope/vim-sensible'
|
Plug 'tpope/vim-sensible'
|
||||||
|
|
||||||
|
@ -62,12 +68,15 @@ else
|
||||||
set number
|
set number
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
for s:dir in ['backup', 'swap', 'undo']
|
||||||
|
call s:ensure_dir($XDG_CACHE_HOME . '/vim/' . s:dir)
|
||||||
|
endfor
|
||||||
|
|
||||||
|
set backupdir=.,$XDG_CACHE_HOME/vim/backup
|
||||||
|
set directory=.,$XDG_CACHE_HOME/vim/swap
|
||||||
if exists('+undofile')
|
if exists('+undofile')
|
||||||
set undofile
|
set undofile
|
||||||
let &undodir = $XDG_CACHE_HOME . '/vim/undo'
|
set undodir=$XDG_CACHE_HOME/vim/undo
|
||||||
if filewritable(&undodir) != 2
|
|
||||||
call mkdir(&undodir, 'p', 0700)
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let g:airline_powerline_fonts = 1
|
let g:airline_powerline_fonts = 1
|
||||||
|
|
Loading…
Reference in a new issue