From 8054352c43168ece62094dfc8ec510e347e19e3c Mon Sep 17 00:00:00 2001 From: Zhuoyun Wei Date: Fri, 27 Oct 2017 23:18:17 -0500 Subject: Speed up Vim exit (#43) * Speed up Vim exit Making cache on every type of events makes exiting Vim quite slow. Per https://github.com/Shougo/deoplete.nvim/blob/e6f4df0108081b8120df9ce83264e4997c4dfedc/doc/deoplete.txt#L891-L907 , only some types of events should be reacted to. --- rplugin/python3/deoplete/sources/beancount.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rplugin/python3/deoplete/sources/beancount.py b/rplugin/python3/deoplete/sources/beancount.py index 0194da3..c29b767 100644 --- a/rplugin/python3/deoplete/sources/beancount.py +++ b/rplugin/python3/deoplete/sources/beancount.py @@ -33,7 +33,9 @@ class Source(Base): self.error('Importing beancount failed.') def on_event(self, context): - self.__make_cache(context) + if context['event'] in ('Init', 'BufWritePost'): + # Make cache on BufNewFile, BufRead, and BufWritePost + self.__make_cache(context) def get_complete_position(self, context): m = re.search(r'\S*$', context['input']) -- cgit v1.2.3-2-gb3c3