Add vim_getoption and vim_setoption functions

This commit is contained in:
ZyX 2014-08-09 13:04:30 +04:00
parent 757e563250
commit e64811c661
1 changed files with 13 additions and 0 deletions

View File

@ -99,10 +99,23 @@ else:
if hasattr(vim, 'options'):
def vim_getbufoption(info, option):
return info['buffer'].options[str(option)]
def vim_getoption(option):
return vim.options[str(option)]
def vim_setoption(option, value):
vim.options[str(option)] = value
else:
def vim_getbufoption(info, option): # NOQA
return getbufvar(info['bufnr'], '&' + option)
def vim_getoption(option): # NOQA
return vim.eval('&g:' + option)
def vim_setoption(option, value): # NOQA
vim.command('let &g:{option} = {value}'.format(
option=option, value=json.encode(value)))
if hasattr(vim, 'tabpages'):
current_tabpage = lambda: vim.current.tabpage