mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
api: {get,set}_option should {get,set} global value of local options (#6405)
- nvim_get_option should return the global default of a local option. - nvim_set_option should set the global default of a local option.
This commit is contained in:
committed by
Justin M. Keyes
parent
66b336d89b
commit
eb0e94f71b
@@ -153,6 +153,28 @@ describe('api', function()
|
||||
nvim('set_option', 'equalalways', false)
|
||||
ok(not nvim('get_option', 'equalalways'))
|
||||
end)
|
||||
|
||||
it('works to get global value of local options', function()
|
||||
eq(false, nvim('get_option', 'lisp'))
|
||||
eq(8, nvim('get_option', 'shiftwidth'))
|
||||
end)
|
||||
|
||||
it('works to set global value of local options', function()
|
||||
nvim('set_option', 'lisp', true)
|
||||
eq(true, nvim('get_option', 'lisp'))
|
||||
eq(false, helpers.curbuf('get_option', 'lisp'))
|
||||
eq(nil, nvim('command_output', 'setglobal lisp?'):match('nolisp'))
|
||||
eq('nolisp', nvim('command_output', 'setlocal lisp?'):match('nolisp'))
|
||||
nvim('set_option', 'shiftwidth', 20)
|
||||
eq('20', nvim('command_output', 'setglobal shiftwidth?'):match('%d+'))
|
||||
eq('8', nvim('command_output', 'setlocal shiftwidth?'):match('%d+'))
|
||||
end)
|
||||
|
||||
it('most window-local options have no global value', function()
|
||||
local status, err = pcall(nvim, 'get_option', 'foldcolumn')
|
||||
eq(false, status)
|
||||
ok(err:match('Invalid option name') ~= nil)
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('nvim_{get,set}_current_buf, nvim_list_bufs', function()
|
||||
|
||||
Reference in New Issue
Block a user