26 lines
550 B
Lua
26 lines
550 B
Lua
M = {}
|
|
|
|
M.ghproxy = "https://ghproxy.net/"
|
|
|
|
---判断可执行文件是否在路径中
|
|
---@param cmd string 可执行命令
|
|
---@return boolean
|
|
function M.has_cmd(cmd)
|
|
local res = vim.fn.executable(cmd)
|
|
return res == 1
|
|
end
|
|
|
|
---comment 加载 lua 模块
|
|
---@param module_name string 加载的模块名称
|
|
function M.load_module(module_name)
|
|
local ok, lua_module = pcall(require, module_name)
|
|
if not ok then
|
|
local hint = string.format("%s load error", module_name)
|
|
vim.notify(hint)
|
|
return nil
|
|
end
|
|
return lua_module
|
|
end
|
|
|
|
return M
|