22 lines
632 B
Lua
22 lines
632 B
Lua
-- lua/custom-functions.lua
|
|
-- A library file with custom functions for cleaner code elsewhere
|
|
|
|
local C = {}
|
|
function C.RunCommand(Command)
|
|
-- TODO IMplement an autocompiler function based on context
|
|
local tt = require("toggleterm")
|
|
local command = string.lower(Command)
|
|
if command == "l" or command == "last" then tt.exec("clear && fc -e -\r") end
|
|
if command == "c" or command == "compile" then tt.exec("clear && make\r") end
|
|
vim.defer_fn(function ()
|
|
vim.api.nvim_echo({
|
|
{ "▶ Terminal: ", "WarningMsg" },
|
|
{ "Running previous terminal command... ", "Normal" },
|
|
}, true, {})
|
|
end, 50)
|
|
return ""
|
|
end
|
|
|
|
|
|
return C
|