diff options
| author | Simon Hauser <Simon-Hauser@outlook.de> | 2022-03-10 13:48:40 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-10 13:48:40 +0100 |
| commit | 234066f875c131b92e99f92495729a8f6f5c1bb9 (patch) | |
| tree | 31d813f3e642d3eb51fd12c7b4adfce00bb2f942 /lua/telescope/previewers/utils.lua | |
| parent | 1daf0917cf859c3c089c62e960b128fe3382fc6d (diff) | |
fix: man_pages previewer, respecting MANPATH and apropos output parsing (#1764)
- introducing putils writer and use it rather than using PAGER env var
- introducing env for lua/telescope/_.lua job interface
- to respect MANPATH (and PATH just in case)
- fix for apropos output parsing might return e.g. `alacritty, Alacritty`
We need to split on first `,`
Diffstat (limited to 'lua/telescope/previewers/utils.lua')
| -rw-r--r-- | lua/telescope/previewers/utils.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lua/telescope/previewers/utils.lua b/lua/telescope/previewers/utils.lua index c312568..d250894 100644 --- a/lua/telescope/previewers/utils.lua +++ b/lua/telescope/previewers/utils.lua @@ -33,12 +33,25 @@ utils.job_maker = function(cmd, bufnr, opts) -- if any of them are missing, cache will be skipped if opts.bufname ~= opts.value or not opts.bufname or not opts.value then local command = table.remove(cmd, 1) + local writer = (function() + if opts.writer ~= nil then + local wcommand = table.remove(opts.writer, 1) + return Job:new { + command = wcommand, + args = opts.writer, + env = opts.env, + cwd = opts.cwd, + } + end + end)() + Job :new({ command = command, args = cmd, env = opts.env, cwd = opts.cwd, + writer = writer, on_exit = vim.schedule_wrap(function(j) if not vim.api.nvim_buf_is_valid(bufnr) then return |
