aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2021-09-19 23:59:04 +0200
committerFrancesco Abbate <francesco.bbt@gmail.com>2021-09-19 23:59:04 +0200
commit6a4e02ef043a1c14446938b6549c86a974abdbdf (patch)
treef42ba7235870a2da0873314c8a7d1a19e5f9f0f7
parent14dd6f1cd6535c1d752a557030cbf11b7e6a37d7 (diff)
downloadlite-xl-6a4e02ef043a1c14446938b6549c86a974abdbdf.tar.gz
lite-xl-6a4e02ef043a1c14446938b6549c86a974abdbdf.zip
Testing a project config to automate buildsconsole-based-lite-project
-rw-r--r--.lite_project.lua58
1 files changed, 58 insertions, 0 deletions
diff --git a/.lite_project.lua b/.lite_project.lua
new file mode 100644
index 00000000..e7d5704e
--- /dev/null
+++ b/.lite_project.lua
@@ -0,0 +1,58 @@
+local core = require "core"
+local keymap = require "core.keymap"
+local command = require "core.command"
+local common = require "core.common"
+local console = require "plugins.console"
+
+local last_build = ""
+
+-- Used to inject into the command anything needed to execute
+-- into the appropriate environment.
+-- Below is for lhelper but other settings may be used.
+-- If not needed just return the command itself without modifications.
+local function bake_command(cmd)
+ return "source $(lhelper env-source lite-xl); " .. cmd
+end
+
+command.add(nil, {
+ ["lite-xl:run"] = function()
+ core.command_view:set_text(last_build, true)
+ core.command_view:enter("Run Lite XL build", function(build)
+ console.run {
+ command = bake_command("scripts/run-local " .. build),
+ file_pattern = "([^?:%s]+%.[^?:%s]+):([1-9]%d*):([1-9]%d*):",
+ file_prefix = build,
+ }
+ last_build = build
+ end)
+ end,
+
+ ["lite-xl:build"] = function()
+ core.command_view:set_text(last_build, true)
+ core.command_view:enter("Run Lite XL build", function(build)
+ console.run {
+ command = bake_command("ninja -C " .. build),
+ file_pattern = "([^?:%s]+%.[^?:%s]+):([1-9]%d*):([1-9]%d*):",
+ file_prefix = build,
+ }
+ last_build = build
+ end)
+ end,
+
+ ["lite-xl:meson-setup"] = function()
+ core.command_view:set_text(last_build, true)
+ core.command_view:enter("Meson setup", function(build)
+ console.run {
+ command = bake_command("rm -fr " .. build .. " && meson setup " .. build),
+ file_pattern = "([^?:%s]+%.[^?:%s]+):([1-9]%d*):([1-9]%d*):",
+ }
+ last_build = build
+ end)
+ end,
+})
+
+keymap.add {
+ ["ctrl+b"] = "lite-xl:build",
+ ["alt+!"] = "lite-xl:run",
+}
+