darkrc/vim/plugin/autosave.vim

24 lines
419 B
VimL
Raw Normal View History

" Extend autosavefeature :)
function! TryAutosave()
2020-08-17 12:54:08 +00:00
if &autowriteall
if &mod
silent write
end
redraw
end
endfunction
if exists("$AUTOSAVE")
2020-08-17 12:54:08 +00:00
set autowriteall
end
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