Remove less from default termopen_env (#295)

This commit is contained in:
Simon Hauser
2020-11-28 13:33:19 +01:00
committed by GitHub
parent 16f11b6c27
commit 7514137e2a

View File

@@ -20,7 +20,7 @@ Previewer.__index = Previewer
-- TODO: Should play with these some more, ty @clason -- TODO: Should play with these some more, ty @clason
local bat_options = {"--style=plain", "--color=always", "--paging=always"} local bat_options = {"--style=plain", "--color=always", "--paging=always"}
local has_less = (vim.fn.executable('less') == 1) and config.values.use_less local has_less = (vim.fn.executable('less') == 1) and config.values.use_less
local termopen_env = vim.tbl_extend("force", { ['GIT_PAGER'] = (has_less and 'less' or ''), LESS = '-RS' }, config.values.set_env) local termopen_env = vim.tbl_extend("force", { ['GIT_PAGER'] = (has_less and 'less' or '') }, config.values.set_env)
-- TODO(conni2461): Workaround for neovim/neovim#11751. Add only quotes when using else branch. -- TODO(conni2461): Workaround for neovim/neovim#11751. Add only quotes when using else branch.
local valuate_shell = function() local valuate_shell = function()
@@ -52,9 +52,9 @@ local bat_maker = function(filename, lnum, start, finish)
if has_less then if has_less then
if start then if start then
table.insert(command, {"--pager", string.format("%sless +%s%s", add_quotes, start, add_quotes)}) table.insert(command, {"--pager", string.format("%sless -RS +%s%s", add_quotes, start, add_quotes)})
else else
table.insert(command, {"--pager", "less"}) table.insert(command, {"--pager", string.format("%sless -RS%s", add_quotes, add_quotes)})
end end
else else
if start and finish then if start and finish then
@@ -87,9 +87,9 @@ local cat_maker = function(filename, _, start, _)
if has_less then if has_less then
if start then if start then
return { 'less', string.format('+%s', start), add_quotes .. vim.fn.expand(filename) .. add_quotes } return { 'less', '-RS', string.format('+%s', start), add_quotes .. vim.fn.expand(filename) .. add_quotes }
else else
return { 'less', add_quotes .. vim.fn.expand(filename) .. add_quotes } return { 'less', '-RS', add_quotes .. vim.fn.expand(filename) .. add_quotes }
end end
else else
return { return {