summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShougo Matsushita <Shougo.Matsu@gmail.com>2019-02-26 09:15:13 +0900
committerShougo Matsushita <Shougo.Matsu@gmail.com>2019-02-26 09:15:13 +0900
commit381c22f5c70974c03a748631de03501093e6c83c (patch)
treeabb36bfbd04758d43dfed24d23bf514eb8ede482
parent98686f0c89ba39f5050f0fc66a91334dae38a208 (diff)
downloaddeoplete.nvim-381c22f5c70974c03a748631de03501093e6c83c.zip
Add get_buf_option()
-rw-r--r--rplugin/python3/deoplete/source/base.py3
-rw-r--r--rplugin/python3/deoplete/source/buffer.py2
-rw-r--r--rplugin/python3/deoplete/source/dictionary.py4
-rw-r--r--rplugin/python3/deoplete/source/omni.py4
4 files changed, 7 insertions, 6 deletions
diff --git a/rplugin/python3/deoplete/source/base.py b/rplugin/python3/deoplete/source/base.py
index c35dfb3..a7c9855 100644
--- a/rplugin/python3/deoplete/source/base.py
+++ b/rplugin/python3/deoplete/source/base.py
@@ -87,3 +87,6 @@ class Base(LoggingMixin):
ft = filetype if (filetype in self.input_patterns) else '_'
return self.input_patterns.get(ft, self.input_pattern)
+
+ def get_buf_option(self, option):
+ return self.vim.call('getbufvar', '%', '&' + option)
diff --git a/rplugin/python3/deoplete/source/buffer.py b/rplugin/python3/deoplete/source/buffer.py
index fe73913..030c03b 100644
--- a/rplugin/python3/deoplete/source/buffer.py
+++ b/rplugin/python3/deoplete/source/buffer.py
@@ -55,7 +55,7 @@ class Source(Base):
try:
self._buffers[context['bufnr']] = {
'bufnr': context['bufnr'],
- 'filetype': self.vim.current.buffer.options['filetype'],
+ 'filetype': self.get_buf_option('filetype'),
'candidates': [
{'word': x} for x in
sorted(parse_buffer_pattern(getlines(self.vim),
diff --git a/rplugin/python3/deoplete/source/dictionary.py b/rplugin/python3/deoplete/source/dictionary.py
index 6f329da..1ed2d67 100644
--- a/rplugin/python3/deoplete/source/dictionary.py
+++ b/rplugin/python3/deoplete/source/dictionary.py
@@ -51,9 +51,7 @@ class Source(Base):
)
def _get_dictionaries(self, context):
- dict_opt = self.vim.options['dictionary']
- if 'dictionary' in self.vim.current.buffer.options:
- dict_opt = self.vim.current.buffer.options['dictionary']
+ dict_opt = self.get_buf_option('dictionary')
if not dict_opt:
return []
diff --git a/rplugin/python3/deoplete/source/omni.py b/rplugin/python3/deoplete/source/omni.py
index 44e4547..9975ae0 100644
--- a/rplugin/python3/deoplete/source/omni.py
+++ b/rplugin/python3/deoplete/source/omni.py
@@ -31,7 +31,7 @@ class Source(Base):
}
def get_complete_position(self, context):
- current_ft = self.vim.current.buffer.options['filetype']
+ current_ft = self.get_buf_option('filetype')
for filetype in list(set([context['filetype']] +
context['filetype'].split('.'))):
@@ -45,7 +45,7 @@ class Source(Base):
self.get_filetype_var(filetype, 'functions')):
if omnifunc == '' and (filetype == current_ft or
filetype in ['css', 'javascript']):
- omnifunc = self.vim.current.buffer.options['omnifunc']
+ omnifunc = self.get_buf_option('omnifunc')
if omnifunc == '':
continue
self._omnifunc = omnifunc