Autosave Vim when in iTerm/Tmux
Vim has a handy FocusLost feature which can be used to set up Vim to autosave whenever you focus away from Vim by adding the following line to your .vimrc
:au FocusLost * :wa
I find this particularly useful when doing front-end development where I find myself switching regularly between Vim and my browser. However, it doesn't play nicely when using iTerm of tmux (and really you should be using one if not both of these).
Fortunately, someone's developed a plugin called vitality.vim which fixes these problems: install it using your favourite plugin manager (personally I'm a fan of Vundle) and you should now have Vim automatically saving your files!
Written by Leo Allen
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Tags
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#