From 87d99bd4d72391fa8841f8957c72e77a8fa2c34c Mon Sep 17 00:00:00 2001 From: Spencer Gilbert Date: Wed, 28 Oct 2020 03:53:08 -0400 Subject: [PATCH] feat: Get BAT_THEME var from environment (#200) Closes: #196 --- lua/telescope/previewers.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/telescope/previewers.lua b/lua/telescope/previewers.lua index d69f73f..8925a9e 100644 --- a/lua/telescope/previewers.lua +++ b/lua/telescope/previewers.lua @@ -23,6 +23,7 @@ local has_less = (vim.fn.executable('less') == 1) and config.values.use_less local bat_maker = function(filename, lnum, start, finish) local command = {"bat"} + local theme = os.getenv("BAT_THEME") if lnum then table.insert(command, { "--highlight-line", lnum}) @@ -40,6 +41,10 @@ local bat_maker = function(filename, lnum, start, finish) end end + if theme ~= nil then + table.insert(command, { "--theme", string.format("%s", theme) }) + end + return flatten { command, bat_options, "--", filename }