diff options
author | jgmdev <jgmdev@gmail.com> | 2022-11-01 20:57:07 -0400 |
---|---|---|
committer | jgmdev <jgmdev@gmail.com> | 2022-11-01 20:57:07 -0400 |
commit | 49139e03398c9d0ecb347267a4882a4eb3f7ee23 (patch) | |
tree | 6ac890a209172a29e09ad47ccd0156e7f7114382 /plugins/exec.lua | |
parent | 380f6ef5fe9f8af19cd1f6b4c043eede51cbfcae (diff) | |
parent | 0971a7a686a4e18ee31b576c460966a5ec20ff01 (diff) | |
download | lite-xl-plugins-49139e03398c9d0ecb347267a4882a4eb3f7ee23.tar.gz lite-xl-plugins-49139e03398c9d0ecb347267a4882a4eb3f7ee23.zip |
Merge branch '2.1'
Diffstat (limited to 'plugins/exec.lua')
-rw-r--r-- | plugins/exec.lua | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/plugins/exec.lua b/plugins/exec.lua index cf2d8f2..b8f61c5 100644 --- a/plugins/exec.lua +++ b/plugins/exec.lua @@ -1,4 +1,4 @@ --- mod-version:2 -- lite-xl 2.0 +-- mod-version:3 local core = require "core" local command = require "core.command" @@ -28,19 +28,23 @@ end command.add("core.docview", { ["exec:insert"] = function() - core.command_view:enter("Insert Result Of Command", function(cmd) - core.active_view.doc:text_input(exec(cmd)) - end) + core.command_view:enter("Insert Result Of Command", { + submit = function(cmd) + core.active_view.doc:text_input(exec(cmd)) + end + }) end, ["exec:replace"] = function() - core.command_view:enter("Replace With Result Of Command", function(cmd) - core.active_view.doc:replace(function(str) - return exec( - "printf %b " .. printfb_quote(str:gsub("%\n$", "") .. "\n") .. " | eval '' " .. shell_quote(cmd), - str:find("%\n$") - ) - end) - end) + core.command_view:enter("Replace With Result Of Command", { + submit = function(cmd) + core.active_view.doc:replace(function(str) + return exec( + "printf %b " .. printfb_quote(str:gsub("%\n$", "") .. "\n") .. " | eval '' " .. shell_quote(cmd), + str:find("%\n$") + ) + end) + end + }) end, }) |