From f323f2d53c79bee2a3f025535bbd85d3af950216 Mon Sep 17 00:00:00 2001 From: DarthMooMancer <107283522+DarthMooMancer@users.noreply.github.com> Date: Fri, 14 Mar 2025 14:30:17 -0400 Subject: [PATCH] Update rust.lua --- lua/Polydev/rust.lua | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/lua/Polydev/rust.lua b/lua/Polydev/rust.lua index 87ad3a9..60f6efe 100644 --- a/lua/Polydev/rust.lua +++ b/lua/Polydev/rust.lua @@ -131,28 +131,7 @@ end function M.run() local root = M.get_project_root() if not root then return print("Error: Project root not found.") end - - -- Open the floating terminal with the command `cargo run` - local term_buf, term_win = M.open_float_terminal("cargo run") - - -- Make the terminal buffer writable and wait for the output - vim.api.nvim_buf_set_option(term_buf, "modifiable", true) - - -- Get the output of the `cargo run` command and display it - local output = vim.fn.system("cargo run") - local success = vim.v.shell_error == 0 - - -- Set the output in the terminal buffer - vim.api.nvim_buf_set_lines(term_buf, 0, -1, false, vim.list_extend( - { success and "Program ran successfully!" or "Error during run:" }, - vim.split(output, "\n", { trimempty = true }) - )) - - -- Set the terminal buffer as non-modifiable again - vim.api.nvim_buf_set_option(term_buf, "modifiable", false) - - -- Optionally, ensure the terminal window is focused - vim.api.nvim_set_current_win(term_win) + M.open_float_terminal("cargo run") end return M