diff options
Diffstat (limited to 'lua/telescope/make_entry.lua')
| -rw-r--r-- | lua/telescope/make_entry.lua | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua index d23dcb7..b0d8060 100644 --- a/lua/telescope/make_entry.lua +++ b/lua/telescope/make_entry.lua @@ -613,9 +613,14 @@ function make_entry.gen_from_packages(opts) end end -function make_entry.gen_from_apropos() +function make_entry.gen_from_apropos(opts) + local sections = {} + for _, section in ipairs(opts.sections) do + sections[section] = true + end + local displayer = entry_display.create { - separator = "", + separator = ' ', items = { { width = 30 }, { remaining = true }, @@ -624,20 +629,21 @@ function make_entry.gen_from_apropos() local make_display = function(entry) return displayer { - entry.value, + { entry.keyword, 'TelescopeResultsFunction' }, entry.description } end return function(line) - local cmd, _, desc = line:match("^(.*)%s+%((.*)%)%s+%-%s(.*)$") - - return { + local keyword, cmd, section, desc = line:match'^((.-)%s*%(([^)]+)%).-)%s+%-%s+(.*)$' + return keyword and sections[section] and { value = cmd, description = desc, ordinal = cmd, display = make_display, - } + section = section, + keyword = keyword, + } or nil end end |
