Change implementation of observing, fixes #584

This commit is contained in:
Adam Stankiewicz
2020-10-17 13:49:45 +02:00
parent 6b9625ecd5
commit 6b663ec330

View File

@@ -31,10 +31,10 @@ set cpo&vim
set nofileignorecase
func! s:Observe(fn)
let b:polyglot_observe = a:fn
let b:PolyglotObserve = function("polyglot#" . a:fn)
augroup polyglot-observer
au! CursorHold,CursorHoldI,BufWritePost <buffer>
\ execute('if polyglot#' . b:polyglot_observe . '() | au! polyglot-observer | endif')
\ if b:PolyglotObserve() | au! polyglot-observer | endif
augroup END
endfunc