chore: cleanup autocmd builtin (#1947)

This commit is contained in:
Simon Hauser
2022-06-12 15:09:41 +02:00
committed by Simon Hauser
parent 838c32d6a8
commit 77e2b8ceea
3 changed files with 46 additions and 96 deletions

View File

@@ -881,12 +881,12 @@ previewers.autocommands = defaulter(function(_)
end,
get_buffer_by_name = function(_, entry)
return entry.group
return entry.value.group_name
end,
define_preview = function(self, entry, status)
local results = vim.tbl_filter(function(x)
return x.group == entry.group
return x.value.group_name == entry.value.group_name
end, status.picker.finder.results)
if self.state.last_set_bufnr then
@@ -894,9 +894,9 @@ previewers.autocommands = defaulter(function(_)
end
local selected_row = 0
if self.state.bufname ~= entry.group then
if self.state.bufname ~= entry.value.group_name then
local display = {}
table.insert(display, string.format(" augroup: %s - [ %d entries ]", entry.group, #results))
table.insert(display, string.format(" augroup: %s - [ %d entries ]", entry.value.group_name, #results))
-- TODO: calculate banner width/string in setup()
-- TODO: get column characters to be the same HL group as border
table.insert(display, string.rep("", vim.fn.getwininfo(status.preview_win)[1].width))
@@ -905,7 +905,10 @@ previewers.autocommands = defaulter(function(_)
if item == entry then
selected_row = idx
end
table.insert(display, string.format(" %-14s▏%-08s %s", item.event, item.ft_pattern, item.command))
table.insert(
display,
string.format(" %-14s▏%-08s %s", item.value.event, item.value.ft_pattern, item.value.command)
)
end
vim.api.nvim_buf_set_option(self.state.bufnr, "filetype", "vim")