diff options
author | ajalexei <23712361+ajalexei@users.noreply.github.com> | 2021-06-15 23:07:59 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-15 23:07:59 +0900 |
commit | 3d3c48f3215c1d663abafefd78a0ca595565df0e (patch) | |
tree | 58e59bee047b9c6eeabd99fe7a17c59e2d2d768a /plugins/texcompile.lua | |
parent | 59bd4e61b9875df5fe155d5cc74f4c89c870db56 (diff) | |
download | lite-xl-plugins-3d3c48f3215c1d663abafefd78a0ca595565df0e.tar.gz lite-xl-plugins-3d3c48f3215c1d663abafefd78a0ca595565df0e.zip |
Uploaded files
added language_bib.lua, pdfview.lua, texcompile.lua
Diffstat (limited to 'plugins/texcompile.lua')
-rw-r--r-- | plugins/texcompile.lua | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/plugins/texcompile.lua b/plugins/texcompile.lua new file mode 100644 index 0000000..7a5fd6e --- /dev/null +++ b/plugins/texcompile.lua @@ -0,0 +1,44 @@ +-- mod-version:1 -- lite-xl 1.16 +local core = require "core" +local command = require "core.command" +local keymap = require "core.keymap" + +command.add("core.docview", { + ["texcompile:tex-compile"] = function() + local av = core.active_view + +-- User's home directory + local homedir = "" + + if PLATFORM == "Windows" then + homedir = os.getenv("USERPROFILE") + else + homedir = os.getenv("HOME") + end + +-- The current (La)TeX file and path + local texname = av:get_name() + local texpath = av:get_filename() + texpath = string.gsub(texpath, '~', homedir) + texpath = string.gsub(texpath, texname, '') + +-- LaTeX compiler - is there any provided by the environment + local texcmd = os.getenv("LITE_LATEX_COMPILER") + + if texcmd == nil then + core.log("No LaTeX compiler found") + else + core.log("LaTeX compiler is %s, compiling %s", texcmd, texname) + + system.exec(string.format("cd %q && %q %q", texpath, texcmd, texname)) + end + +-- core.add_thread(function() +-- coroutine.yield(5) +-- os.remove(htmlfile) +-- end) + end +}) + + +keymap.add { ["ctrl+shift+t"] = "texcompile:tex-compile" } |