From 9975b73dfb7490fa9237f3213e998a8c59eebf35 Mon Sep 17 00:00:00 2001 From: altermo <107814000+altermo@users.noreply.github.com> Date: Sun, 2 Aug 2026 20:19:50 +0200 Subject: [PATCH] fix(optwin): handle tabpage local options --- runtime/scripts/optwin.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/runtime/scripts/optwin.lua b/runtime/scripts/optwin.lua index 67b465f293..1ae5087431 100644 --- a/runtime/scripts/optwin.lua +++ b/runtime/scripts/optwin.lua @@ -463,8 +463,10 @@ local options_list = { local local_to_window = N_ '(local to window)' local local_to_buffer = N_ '(local to buffer)' +local local_to_tabpage = N_ '(local to tabpage)' local global_or_local_to_buffer = N_ '(global or local to buffer)' local global_or_local_to_window = N_ '(global or local to window)' +local global_or_local_to_tabpage = N_ '(global or local to tabpage)' local lines = { N_ '" Each "set" line shows the current value of an option (on the left).', @@ -503,10 +505,16 @@ for header_number, options in ipairs(options_list) do table.insert(lines, '\t' .. global_or_local_to_buffer) elseif info.scope == 'win' and info.global_local then table.insert(lines, '\t' .. global_or_local_to_window) + elseif info.scope == 'tab' and info.global_local then + table.insert(lines, '\t' .. global_or_local_to_tabpage) elseif info.scope == 'buf' then table.insert(lines, '\t' .. local_to_buffer) elseif info.scope == 'win' then table.insert(lines, '\t' .. local_to_window) + elseif info.scope == 'tab' then + table.insert(lines, '\t' .. local_to_tabpage) + else + assert(info.scope == 'global') end local shortname = info.shortname or name @@ -592,7 +600,7 @@ local function update_current_line() ---@type any local value - if info.global_local or info.scope == 'global' then + if info.global_local or info.scope == 'global' or info.scope == 'tab' then value = vim.o[name] --[[@as any]] else local win = find_window_to_have_options_in() @@ -642,7 +650,7 @@ local function current_line_set_option() value = assert(tonumber(value), value .. ' is not a number') end - if info.global_local or info.scope == 'global' then + if info.global_local or info.scope == 'global' or info.scope == 'tab' then ---@diagnostic disable-next-line: no-unknown vim.o[name] = value else