Skip to content

Commit

Permalink
feat(compiler): write compile lua file if debug set
Browse files Browse the repository at this point in the history
  • Loading branch information
EdenEast committed Dec 26, 2022
1 parent 9c3756a commit f32eef4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion lua/nightfox/lib/compiler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,15 @@ vim.o.background = "%s"
opts.name = style
local output_path, output_file = config.get_compiled_info(opts)
util.ensure_dir(output_path)
local file = io.open(output_file, "wb")

local file
if vim.g.nightfox_debug then
file = io.open(output_file .. ".lua", "wb")
file:write(table.concat(lines, "\n"))
file:close()
end

file = io.open(output_file, "wb")

local f = loadstring(table.concat(lines, "\n"), "=")
if not f then
Expand Down
10 changes: 9 additions & 1 deletion lua/nightfox/lib/vim/compiler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,15 @@ set background="%s"]],
opts.name = style
local output_path, output_file = config.get_compiled_info(opts)
util.ensure_dir(output_path)
local file = io.open(output_file, "wb")

local file
if vim.g.nightfox_debug then
file = io.open(output_file .. ".lua", "wb")
file:write(table.concat(lines, "\n"))
file:close()
end

file = io.open(output_file, "wb")

local ld = load or loadstring -- loadstring == 5.1, load >= 5.2
local f = ld(table.concat(lines, "\n"), "=")
Expand Down

0 comments on commit f32eef4

Please sign in to comment.