diff --git a/lua/telescope/previewers.lua b/lua/telescope/previewers.lua index a51c17e..e6e2f8c 100644 --- a/lua/telescope/previewers.lua +++ b/lua/telescope/previewers.lua @@ -20,7 +20,7 @@ Previewer.__index = Previewer -- TODO: Should play with these some more, ty @clason local bat_options = {"--style=plain", "--color=always", "--paging=always"} 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. local valuate_shell = function() @@ -52,9 +52,9 @@ local bat_maker = function(filename, lnum, start, finish) if has_less 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 - table.insert(command, {"--pager", "less"}) + table.insert(command, {"--pager", string.format("%sless -RS%s", add_quotes, add_quotes)}) end else if start and finish then @@ -87,9 +87,9 @@ local cat_maker = function(filename, _, start, _) if has_less 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 - return { 'less', add_quotes .. vim.fn.expand(filename) .. add_quotes } + return { 'less', '-RS', add_quotes .. vim.fn.expand(filename) .. add_quotes } end else return {