30 lines
701 B
Lua
30 lines
701 B
Lua
-- ------------------------------------------------------------
|
|
-- BUILD SYSTEM
|
|
local function build(args)
|
|
if vim.fn.filereadable("build.sh") == 0 then
|
|
vim.notify("No build.sh found in current directory.", vim.log.levels.WARN)
|
|
return
|
|
end
|
|
|
|
vim.cmd("wall")
|
|
|
|
local command = "./build.sh"
|
|
|
|
if #args > 0 then
|
|
command = command .. " " .. table.concat(args, " ")
|
|
end
|
|
|
|
send("clear && " .. command)
|
|
end
|
|
|
|
vim.api.nvim_create_user_command(
|
|
"Build",
|
|
function(opts) build(opts.fargs) end,
|
|
{
|
|
nargs = "*",
|
|
desc = "Run project build.sh",
|
|
}
|
|
)
|
|
map("n", "<C-Space>", function() build({}) end, { desc = "Build project", })
|
|
map("t", "<C-Space>", function() build({}) end, { desc = "Build project", })
|