chore: renamed open_float_terminal to terminal and annotated utils.lua
This commit is contained in:
@@ -16,14 +16,14 @@ function M.run()
|
||||
local output = vim.fn.system(table.concat(cmd, "/"))
|
||||
|
||||
if not vim.v.shell_error == 0 then
|
||||
local term_buf = utils.open_float_terminal(cmd)
|
||||
local term_buf = utils.terminal(cmd)
|
||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", true)
|
||||
vim.api.nvim_buf_set_lines(term_buf, 0, -1, false,
|
||||
vim.list_extend({ "Error during compilation:" }, vim.split(output, "\n", { trimempty = true }))
|
||||
)
|
||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", false)
|
||||
else
|
||||
utils.open_float_terminal({ "cd " .. root, "build" .. " && .", utils.get_project_name() })
|
||||
utils.terminal({ "cd " .. root, "build" .. " && .", utils.get_project_name() })
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -16,14 +16,14 @@ function M.run()
|
||||
local output = vim.fn.system(table.concat(cmd, "/"))
|
||||
|
||||
if not vim.v.shell_error == 0 then
|
||||
local term_buf = utils.open_float_terminal(cmd)
|
||||
local term_buf = utils.terminal(cmd)
|
||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", true)
|
||||
vim.api.nvim_buf_set_lines(term_buf, 0, -1, false,
|
||||
vim.list_extend({ "Error during compilation:" }, vim.split(output, "\n", { trimempty = true }))
|
||||
)
|
||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", false)
|
||||
else
|
||||
utils.open_float_terminal({ "cd " .. root, "build" .. " && .", utils.get_project_name() })
|
||||
utils.terminal({ "cd " .. root, "build" .. " && .", utils.get_project_name() })
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -16,14 +16,14 @@ function M.run()
|
||||
local output = vim.fn.system(cmd)
|
||||
|
||||
if not vim.v.shell_error == 0 then
|
||||
local term_buf = utils.open_float_terminal({ cmd })
|
||||
local term_buf = utils.terminal({ cmd })
|
||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", true)
|
||||
vim.api.nvim_buf_set_lines(term_buf, 0, -1, false,
|
||||
vim.list_extend({ "Error during compilation:" }, vim.split(output, "\n", { trimempty = true }))
|
||||
)
|
||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", false)
|
||||
else
|
||||
utils.open_float_terminal({ "java -cp " .. root, "build" .. " Main" })
|
||||
utils.terminal({ "java -cp " .. root, "build" .. " Main" })
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ end
|
||||
function M.run()
|
||||
local init_lua_path = utils.get_project_root() .. "/lua/" .. utils.get_project_name() .. "/init.lua"
|
||||
if vim.fn.filereadable(init_lua_path) == 1 then
|
||||
utils.open_float_terminal({ "lua " .. init_lua_path })
|
||||
utils.terminal({ "lua " .. init_lua_path })
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -27,12 +27,12 @@ end
|
||||
function M.install_dependency()
|
||||
vim.ui.input({ prompt = "Enter pip module: " }, function(pip_module)
|
||||
if not pip_module or pip_module == "" then return print("Pip canceled") end
|
||||
utils.open_float_terminal({ "pip install " .. pip_module })
|
||||
utils.terminal({ "pip install " .. pip_module })
|
||||
end)
|
||||
end
|
||||
|
||||
function M.run()
|
||||
utils.open_float_terminal({ "python3 " .. utils.get_project_root(), "main.py" })
|
||||
utils.terminal({ "python3 " .. utils.get_project_root(), "main.py" })
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@@ -17,14 +17,14 @@ function M.run()
|
||||
local output = vim.fn.system(table.concat(cmd))
|
||||
|
||||
if not vim.v.shell_error == 0 then
|
||||
local term_buf = utils.open_float_terminal(cmd)
|
||||
local term_buf = utils.terminal(cmd)
|
||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", true)
|
||||
vim.api.nvim_buf_set_lines(term_buf, 0, -1, false,
|
||||
vim.list_extend({ "Error during compilation:" }, vim.split(output, "\n", { trimempty = true }))
|
||||
)
|
||||
vim.api.nvim_buf_set_option(term_buf, "modifiable", false)
|
||||
else
|
||||
utils.open_float_terminal({ "cargo run" })
|
||||
utils.terminal({ "cargo run" })
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user