fix: autocmd, show desc if available (#2046)
This commit is contained in:
@@ -1177,12 +1177,16 @@ function make_entry.gen_from_autocommands(opts)
|
|||||||
|
|
||||||
return function(entry)
|
return function(entry)
|
||||||
local group_name = vim.F.if_nil(entry.group_name, "<anonymous>")
|
local group_name = vim.F.if_nil(entry.group_name, "<anonymous>")
|
||||||
|
local command = entry.command
|
||||||
|
if entry.desc and vim.startswith(command, "<lua: ") then
|
||||||
|
command = entry.desc
|
||||||
|
end
|
||||||
return make_entry.set_default_entry_mt({
|
return make_entry.set_default_entry_mt({
|
||||||
value = {
|
value = {
|
||||||
event = entry.event,
|
event = entry.event,
|
||||||
group_name = group_name,
|
group_name = group_name,
|
||||||
pattern = entry.pattern,
|
pattern = entry.pattern,
|
||||||
command = entry.command,
|
command = command,
|
||||||
},
|
},
|
||||||
--
|
--
|
||||||
ordinal = entry.event .. " " .. group_name .. " " .. entry.pattern .. " " .. entry.command,
|
ordinal = entry.event .. " " .. group_name .. " " .. entry.pattern .. " " .. entry.command,
|
||||||
|
|||||||
@@ -925,7 +925,7 @@ previewers.autocommands = defaulter(function(_)
|
|||||||
end
|
end
|
||||||
table.insert(
|
table.insert(
|
||||||
display,
|
display,
|
||||||
string.format(" %-14s▏%-08s %s", item.value.event, item.value.ft_pattern, item.value.command)
|
string.format(" %-14s▏%-08s %s", item.value.event, item.value.pattern, item.value.command)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user