feat: Get BAT_THEME var from environment (#200)

Closes: #196
This commit is contained in:
Spencer Gilbert
2020-10-28 03:53:08 -04:00
committed by GitHub
parent a3afb35614
commit 87d99bd4d7

View File

@@ -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
}