Disable vim.bindeval support for vim_getwar for old vim versions

This commit is contained in:
ZyX 2013-06-22 19:00:56 +04:00
parent 9080a34ee8
commit 31c86486fe
1 changed files with 3 additions and 9 deletions

View File

@ -60,17 +60,11 @@ else:
vim_get_func = VimFunc
if hasattr(vim, 'vars'):
# It may crash on some old vim versions and I do not remember in which patch
# I fixed this crash.
if hasattr(vim, 'vars') and vim.vvars['version'] > 703:
def vim_getvar(varname):
return _vim_to_python(vim.vars[str(varname)])
elif hasattr(vim, 'bindeval'):
_vim_globals = vim.bindeval('g:')
def vim_getvar(varname): # NOQA
try:
return _vim_to_python(_vim_globals[str(varname)])
except (KeyError, IndexError):
raise KeyError(varname)
else:
_vim_exists = vim_get_func('exists', rettype=int)