From 7170de19714acd5efa6979ef94de2a29e41d6173 Mon Sep 17 00:00:00 2001 From: b-r-o-c-k Date: Sun, 29 Apr 2018 21:02:17 -0500 Subject: api: Make nvim_set_option() update `:verbose set ...` Make `:verbose set ...` show when an option was last modified by an API client or Lua script/chunk. In the case of an API client, the channel ID is displayed. --- test/functional/api/vim_spec.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test') diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 718294d941..599280d684 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -291,6 +291,21 @@ describe('api', function() eq(false, status) ok(err:match('Invalid option name') ~= nil) end) + + it('updates where the option was last set from', function() + nvim('set_option', 'equalalways', false) + local status, rv = pcall(nvim, 'command_output', + 'verbose set equalalways?') + eq(true, status) + ok(nil ~= string.find(rv, 'noequalalways\n'.. + '\tLast set from API client %(channel id %d+%)')) + + nvim('execute_lua', 'vim.api.nvim_set_option("equalalways", true)', {}) + local status, rv = pcall(nvim, 'command_output', + 'verbose set equalalways?') + eq(true, status) + eq(' equalalways\n\tLast set from Lua', rv) + end) end) describe('nvim_{get,set}_current_buf, nvim_list_bufs', function() -- cgit