feat(vim_options): show scope information in display (#1956)

Also make type, scope and value searchable
This commit is contained in:
Simon Hauser
2022-05-22 11:50:00 +02:00
committed by Simon Hauser
parent 7648e5d891
commit 5510587ff4

View File

@@ -817,6 +817,7 @@ function make_entry.gen_from_vimoptions()
items = { items = {
{ width = 25 }, { width = 25 },
{ width = 12 }, { width = 12 },
{ width = 11 },
{ remaining = true }, { remaining = true },
}, },
} }
@@ -825,6 +826,7 @@ function make_entry.gen_from_vimoptions()
return displayer { return displayer {
{ entry.value.name, "Keyword" }, { entry.value.name, "Keyword" },
{ "[" .. entry.value.type .. "]", "Type" }, { "[" .. entry.value.type .. "]", "Type" },
{ "[" .. entry.value.scope .. "]", "Identifier" },
utils.display_termcodes(tostring(entry.value.value)), utils.display_termcodes(tostring(entry.value.value)),
} }
end end
@@ -836,13 +838,17 @@ function make_entry.gen_from_vimoptions()
name = o.name, name = o.name,
value = o.default, value = o.default,
type = o.type, type = o.type,
scope = o.scope,
}, },
ordinal = o.name, ordinal = string.format("%s %s %s", o.name, o.type, o.scope),
} }
local ok, value = pcall(vim.api.nvim_get_option, o.name) local ok, value = pcall(vim.api.nvim_get_option, o.name)
if ok then if ok then
entry.value.value = value entry.value.value = value
entry.ordinal = entry.ordinal .. " " .. utils.display_termcodes(tostring(value))
else
entry.ordinal = entry.ordinal .. " " .. utils.display_termcodes(tostring(o.default))
end end
return entry return entry