aboutsummaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-05-26 20:25:47 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-05-26 20:25:47 +1200
commitfe3d0bb24d6df0a3a7e01aa495d44f3422ff736e (patch)
treebfc12676e7862b02a0861f7f93eb9f93db0a89b8 /autoload
parentMerge branch 'release/v0.3.0' into develop (diff)
downloadvim-insert-timeout-fe3d0bb24d6df0a3a7e01aa495d44f3422ff736e.tar.gz
vim-insert-timeout-fe3d0bb24d6df0a3a7e01aa495d44f3422ff736e.zip
Refactor with autoload
Diffstat (limited to 'autoload')
-rw-r--r--autoload/insert_timeout.vim14
1 files changed, 14 insertions, 0 deletions
diff --git a/autoload/insert_timeout.vim b/autoload/insert_timeout.vim
new file mode 100644
index 0000000..5df8b3d
--- /dev/null
+++ b/autoload/insert_timeout.vim
@@ -0,0 +1,14 @@
+" Set update time to configured variable or default 20 seconds
+function! insert_timeout#Enter() abort
+ let s:updatetime = &updatetime
+ let &updatetime = get(g:, 'insert_timeout_duration', 20000)
+endfunction
+
+" Restore update time to its previous value
+function! insert_timeout#Leave() abort
+ if exists('s:updatetime')
+ return
+ endif
+ let &updatetime = s:updatetime
+ unlet s:updatetime
+endfunction