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 `,`
This commit is contained in:
Simon Hauser
2022-03-10 13:48:40 +01:00
committed by GitHub
parent 1daf0917cf
commit 234066f875
7 changed files with 42 additions and 3 deletions

View File

@@ -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