feat(previewer): allow passing env to new_termopen_previewer (#3224)

* Allow passing env through term opts

* Add doc update
This commit is contained in:
MarcusGrass
2024-07-26 05:25:46 +02:00
committed by GitHub
parent 47ab113de5
commit 3264f0ae9d
2 changed files with 5 additions and 2 deletions

View File

@@ -90,13 +90,16 @@ end
--- Additionally you can define:
--- - `title` a static title for example "File Preview"
--- - `dyn_title(self, entry)` a dynamic title function which gets called
--- - `env` table: define environment variables to forward to the terminal
--- process. Example:
--- - `{ ['PAGER'] = '', ['MANWIDTH'] = 50 }`
--- when config value `dynamic_preview_title = true`
---
--- It's an easy way to get your first previewer going and it integrates well
--- with `bat` and `less`. Providing out of the box scrolling if the command
--- uses less.
---
--- Furthermore, it will forward all `config.set_env` environment variables to
--- Furthermore, if `env` is not set, it will forward all `config.set_env` environment variables to
--- that terminal process.
previewers.new_termopen_previewer = term_previewer.new_termopen_previewer

View File

@@ -202,7 +202,7 @@ previewers.new_termopen_previewer = function(opts)
local term_opts = {
cwd = opts.cwd or vim.loop.cwd(),
env = conf.set_env,
env = opts.env or conf.set_env,
}
local cmd = opts.get_command(entry, status)