diff options
| author | Senghan Bright <senghan.bright@deltaprojects.com> | 2020-10-07 22:01:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-07 16:01:47 -0400 |
| commit | a7957b2bdc5c3ce86092544448b4eb6ebcbb645e (patch) | |
| tree | 4f566baf6741c6875d05cadcef85ab26228055a2 /lua/telescope/make_entry.lua | |
| parent | 2053a2621a56177da34032a055dffe3f7bb384d1 (diff) | |
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 <devries.timothyj@gmail.com>
Diffstat (limited to 'lua/telescope/make_entry.lua')
| -rw-r--r-- | lua/telescope/make_entry.lua | 18 |
1 files changed, 15 insertions, 3 deletions
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 |
