2020-07-06 09:09:16 +00:00
|
|
|
" Extend autosavefeature :)
|
|
|
|
|
|
|
|
function! TryAutosave()
|
|
|
|
if &autowriteall
|
|
|
|
if &mod
|
|
|
|
silent write
|
|
|
|
end
|
|
|
|
redraw
|
|
|
|
end
|
|
|
|
endfunction
|
|
|
|
|
2020-07-22 09:09:52 +00:00
|
|
|
if exists("$AUTOSAVE")
|
|
|
|
set autowriteall
|
|
|
|
end
|
|
|
|
|
2020-07-06 09:09:16 +00:00
|
|
|
augroup autosave
|
|
|
|
autocmd!
|
|
|
|
autocmd BufLeave * call TryAutosave()
|
|
|
|
autocmd CursorHold * call TryAutosave()
|
|
|
|
autocmd InsertLeave * call TryAutosave()
|
|
|
|
autocmd TextChanged * call TryAutosave()
|
|
|
|
autocmd FocusLost * call TryAutosave()
|
|
|
|
augroup END
|