diff --git a/README.md b/README.md index 72f67a8..7edaa8f 100644 --- a/README.md +++ b/README.md @@ -227,7 +227,7 @@ local opts = { tools = { -- rust-tools options -- how to execute terminal commands - -- options right now: termopen / quickfix + -- options right now: termopen / quickfix / toggleterm / vimux executor = require("rust-tools.executors").termopen, -- callback to execute once rust-analyzer is done initializing the workspace diff --git a/lua/rust-tools/config.lua b/lua/rust-tools/config.lua index d4ce0ac..2854138 100644 --- a/lua/rust-tools/config.lua +++ b/lua/rust-tools/config.lua @@ -11,7 +11,7 @@ local defaults = { tools = { -- rust-tools options -- how to execute terminal commands - -- options right now: termopen / quickfix + -- options right now: termopen / quickfix / toggleterm / vimux executor = require("rust-tools.executors").termopen, -- callback to execute once rust-analyzer is done initializing the workspace diff --git a/lua/rust-tools/executors/init.lua b/lua/rust-tools/executors/init.lua index 258ddc5..408da84 100644 --- a/lua/rust-tools/executors/init.lua +++ b/lua/rust-tools/executors/init.lua @@ -1,11 +1,13 @@ local termopen = require("rust-tools.executors.termopen") local quickfix = require("rust-tools.executors.quickfix") local toggleterm = require("rust-tools.executors.toggleterm") +local vimux = require("rust-tools.executors.vimux") local M = {} M.termopen = termopen M.quickfix = quickfix M.toggleterm = toggleterm +M.vimux = vimux return M diff --git a/lua/rust-tools/executors/vimux.lua b/lua/rust-tools/executors/vimux.lua new file mode 100644 index 0000000..e448cdd --- /dev/null +++ b/lua/rust-tools/executors/vimux.lua @@ -0,0 +1,14 @@ +local utils = require("rust-tools.utils.utils") + +local M = {} + +function M.execute_command(command, args, cwd) + local full_command = utils.chain_commands({ + utils.make_command_from_args("cd", { cwd }), + utils.make_command_from_args(command, args), + }) + + vim.fn.VimuxRunCommand(full_command) +end + +return M