2020-07-06 09:09:16 +00:00
|
|
|
" Extend autosavefeature :)
|
|
|
|
|
|
|
|
function! TryAutosave()
|
2020-08-19 15:35:34 +00:00
|
|
|
if &autowriteall && &mod && &buftype==""
|
|
|
|
silent write
|
2020-08-19 15:32:32 +00:00
|
|
|
redraw
|
2020-08-17 12:54:08 +00:00
|
|
|
end
|
2020-07-06 09:09:16 +00:00
|
|
|
endfunction
|
|
|
|
|
2020-07-22 09:09:52 +00:00
|
|
|
if exists("$AUTOSAVE")
|
2020-08-17 12:54:08 +00:00
|
|
|
set autowriteall
|
2020-07-22 09:09:52 +00:00
|
|
|
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
|