Plugins for the lite text editor
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
537 B

-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local command = require "core.command"
local function eval(str)
local fn, err = load("return " .. str)
if not fn then fn, err = load(str) end
assert(fn, err)
return tostring(fn())
end
command.add("core.docview", {
["eval:insert"] = function()
core.command_view:enter("Evaluate And Insert Result", function(cmd)
core.active_view.doc:text_input(eval(cmd))
end)
end,
["eval:replace"] = function()
core.active_view.doc:replace(eval)
end,
})