From a7957b2bdc5c3ce86092544448b4eb6ebcbb645e Mon Sep 17 00:00:00 2001 From: Senghan Bright Date: Wed, 7 Oct 2020 22:01:47 +0200 Subject: feat: Manpages finder (output of apropos) (#134) First edition. Sometimes weird things can happen with the previewer, but I think I got it 99% working. * feat: Manpages finder (output of apropos) * fixup: Add previewer and fix comments Co-authored-by: TJ DeVries --- lua/telescope/make_entry.lua | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'lua/telescope/make_entry.lua') diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua index 276f149..891d4af 100644 --- a/lua/telescope/make_entry.lua +++ b/lua/telescope/make_entry.lua @@ -403,15 +403,27 @@ function make_entry.gen_from_packages(opts) return function(module_name) local entry = { valid = module_name ~= "", - entry_type = make_entry.types.GENERIC, - value = module_name, ordinal = module_name, - } + } entry.display = make_display(module_name) return entry end end +function make_entry.gen_from_apropos(opts) + opts = opts or {} + + return function(line) + local cmd, _, desc = line:match("^(.*)%s+%((.*)%)%s+%-%s(.*)$") + + return { + value = cmd, + ordinal = cmd, + display = string.format("%-30s : %s", cmd, desc) + } + end +end + return make_entry -- cgit v1.2.3