JaredVogt / vimrc

CONFIG: my vimrc
0 stars 0 forks source link

autosave and switch back to normal mode #8

Closed JaredVogt closed 8 years ago

JaredVogt commented 8 years ago

How do I trigger these on loss of focus - what exactly is "loss of focus" - and does it apply when using vim in a terminal?

JaredVogt commented 8 years ago

ok - at least with macvim, I figured it out. I have it currently set so that when the app loses focus - or changes mode it saves the file (this latter one might be overkill). Next step, figure out how to have it switch back to insert after a period of time.

JaredVogt commented 8 years ago

added chunk to switch after period of time...

" set 'updatetime' to 15 seconds when in insert mode (for command below) - http://vim.wikia.com/wiki/To_switch_back_to_normal_mode_automatically_after_inaction
au InsertEnter * let updaterestore=&updatetime | set updatetime=120000
au InsertLeave * let &updatetime=updaterestore
" automatically leave insert mode after 'updatetime' milliseconds of inaction
au CursorHoldI * stopinsert