Fandom

Vim Tips Wiki

To switch back to normal mode automatically after inaction

1,624pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Tip 1540 Printable Monobook Previous Next

created December 9, 2007 · complexity basic · version 7.0


Looking for a way to exit insert mode automatically when you haven't typed anything for a few seconds?

Try:

" automatically leave insert mode after 'updatetime' milliseconds of inaction
au CursorHoldI * stopinsert

If you find that this event fires too quickly, you can adjust 'updatetime' to suit your needs, but you might want to consider doing so only when you enter insert mode:

" set 'updatetime' to 15 seconds when in insert mode
au InsertEnter * let updaterestore=&updatetime | set updatetime=15000
au InsertLeave * let &updatetime=updaterestore

ReferencesEdit

CommentsEdit

This is the greatest vim tip of all time. Setting the timeout to a couple of seconds forces you to use vim very efficiently.

Also on Fandom

Random Wiki