Update autocmd, highlights and help_tags previewers (#332)
Also make vim buffer line configurable
This commit is contained in:
@@ -391,21 +391,6 @@ function make_entry.gen_from_treesitter(opts)
|
||||
end
|
||||
end
|
||||
|
||||
function make_entry.gen_from_taglist(_)
|
||||
local delim = string.char(9)
|
||||
|
||||
return function(line)
|
||||
local entry = {}
|
||||
local tag = (line..delim):match("(.-)" .. delim)
|
||||
entry.valid = tag ~= ""
|
||||
entry.display = tag
|
||||
entry.value = tag
|
||||
entry.ordinal = tag
|
||||
|
||||
return entry
|
||||
end
|
||||
end
|
||||
|
||||
function make_entry.gen_from_packages(opts)
|
||||
opts = opts or {}
|
||||
|
||||
@@ -492,23 +477,11 @@ function make_entry.gen_from_highlights()
|
||||
return display, { { { 0, #display }, display } }
|
||||
end
|
||||
|
||||
local preview_command = function(entry, bufnr)
|
||||
local hl = entry.value
|
||||
vim.api.nvim_buf_set_option(bufnr, 'filetype', 'vim')
|
||||
local output = vim.split(vim.fn.execute('hi ' .. hl), '\n')
|
||||
local start = string.find(output[2], 'xxx', 1, true)
|
||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, true, output)
|
||||
vim.api.nvim_buf_add_highlight(bufnr, -1, hl, 1, start - 1, start + 2)
|
||||
end
|
||||
|
||||
return function(entry)
|
||||
return {
|
||||
value = entry,
|
||||
display = make_display,
|
||||
ordinal = entry,
|
||||
|
||||
preview_command = preview_command
|
||||
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user