aboutsummaryrefslogtreecommitdiff
path: root/plugin/insert_timeout.vim
blob: 80915d3ace525950f6333226d4dc50b8e4ac8ee9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"
" insert_timeout.vim: Leave insert mode automatically if there is no activity
" for a certain number of seconds, with an 'updatetime' hook.  This is just a
" plugin packaging of Vim tip #1540.
"
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
"
if exists('loaded_insert_timeout') || &compatible || v:version < 700
  finish
endif
let loaded_insert_timeout = 1

" Set up actions in a group
augroup insert_timeout
  autocmd!
  autocmd InsertEnter *
        \ call insert_timeout#Enter()
  autocmd InsertLeave *
        \ call insert_timeout#Leave()
  autocmd CursorHoldI *
        \ stopinsert
augroup END