How can I make Vim autosave files when it loses focus?

You don’t care about errors in those circumstances since there is nothing you can reasonably do about them anyway – especially when losing focus. So just swallow them:

autocmd BufLeave,FocusLost * silent! wall

Much simpler than an elaborate dance to figure out where there would be an error in order to avoid it.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)