More clean-ups

Better Cross-platform stuff

https://vimways.org/2018/from-vimrc-to-vim/
This commit is contained in:
2020-08-08 13:50:22 -07:00
parent 5a42a0c8e1
commit e12d093365
10 changed files with 140 additions and 126 deletions

30
plugin/folders.vim Normal file
View File

@@ -0,0 +1,30 @@
" Stolen from maralla/dotvim
function! s:EnsureExists(path) abort
let l:path = expand(a:path)
if !isdirectory(l:path)
try
call mkdir(l:path)
catch
echom "Could not create directory " . l:path
endtry
endif
endfunction
call s:EnsureExists(resolve($MYVIM . '/.cache'))
" persistent undo
if exists('+undofile')
let &undodir = resolve($MYVIM . '/.cache/undo')
set undofile
call s:EnsureExists(&undodir)
endif
" backups
let &backupdir=resolve($MYVIM . '/.cache/backup')
set backup
call s:EnsureExists(&backupdir)
" swap files
let &directory=resolve($MYVIM . '/.cache/swap')
set noswapfile
call s:EnsureExists(&directory)