feat(api): add nvim_get_option_value

This commit is contained in:
Gregory Anders
2021-10-11 22:09:08 -06:00
parent 7b910a1716
commit 71ac00ccb5
9 changed files with 193 additions and 121 deletions

View File

@@ -949,6 +949,33 @@ describe('API', function()
end)
end)
describe('nvim_get_option_value, nvim_set_option_value', function()
it('works', function()
ok(nvim('get_option_value', 'equalalways', {}))
nvim('set_option_value', 'equalalways', false, {})
ok(not nvim('get_option_value', 'equalalways', {}))
end)
it('can get local values when global value is set', function()
eq(0, nvim('get_option_value', 'scrolloff', {}))
eq(-1, nvim('get_option_value', 'scrolloff', {scope = 'local'}))
end)
it('can set global and local values', function()
nvim('set_option_value', 'makeprg', 'hello', {})
eq('hello', nvim('get_option_value', 'makeprg', {}))
eq('', nvim('get_option_value', 'makeprg', {scope = 'local'}))
nvim('set_option_value', 'makeprg', 'world', {scope = 'local'})
eq('world', nvim('get_option_value', 'makeprg', {scope = 'local'}))
nvim('set_option_value', 'makeprg', 'goodbye', {scope = 'global'})
eq('goodbye', nvim('get_option_value', 'makeprg', {scope = 'global'}))
nvim('set_option_value', 'makeprg', 'hello', {})
eq('hello', nvim('get_option_value', 'makeprg', {scope = 'global'}))
eq('hello', nvim('get_option_value', 'makeprg', {}))
eq('', nvim('get_option_value', 'makeprg', {scope = 'local'}))
end)
end)
describe('nvim_{get,set}_current_buf, nvim_list_bufs', function()
it('works', function()
eq(1, #nvim('list_bufs'))