summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorSpencer Gilbert <Spencer.Gilbert@gmail.com>2020-10-28 03:53:08 -0400
committerGitHub <noreply@github.com>2020-10-28 03:53:08 -0400
commit87d99bd4d72391fa8841f8957c72e77a8fa2c34c (patch)
tree95717075ce5a5ec6206cac6d47dcc3240bc20b87 /lua
parenta3afb3561466045488ee8acbffa6db7ec92c5dc7 (diff)
feat: Get BAT_THEME var from environment (#200)
Closes: #196
Diffstat (limited to 'lua')
-rw-r--r--lua/telescope/previewers.lua5
1 files changed, 5 insertions, 0 deletions
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
}