aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhuoyun Wei2017-10-27 23:18:17 -0500
committerxentac2017-10-27 21:18:17 -0700
commit8054352c43168ece62094dfc8ec510e347e19e3c (patch)
treed1a6c8a7917e059c524ee978d1ae229fc647c1ac
parent8b8073706f800f10acc5e107fe2d77f68bcc3458 (diff)
downloadvim-beancount-8054352c43168ece62094dfc8ec510e347e19e3c.tar.gz
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.
-rw-r--r--rplugin/python3/deoplete/sources/beancount.py4
1 files changed, 3 insertions, 1 deletions
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'])