fix(util): remove unused functions
This commit is contained in:
@@ -4,44 +4,6 @@ local Util = {}
|
|||||||
|
|
||||||
Util.os_name = vim.uv.os_uname().sysname
|
Util.os_name = vim.uv.os_uname().sysname
|
||||||
|
|
||||||
--- Get the module path of a file
|
|
||||||
---@param file string
|
|
||||||
---@return string|nil
|
|
||||||
local function get_module_path(file)
|
|
||||||
for _, rtp in ipairs(vim.api.nvim_list_runtime_paths()) do
|
|
||||||
if file:sub(1, #rtp) == rtp then
|
|
||||||
file = file:sub(#rtp + 2)
|
|
||||||
|
|
||||||
if file:sub(1, 4) == "lua/" then
|
|
||||||
file = file:sub(5)
|
|
||||||
end
|
|
||||||
|
|
||||||
return file:match("(.*)%.lua$"):gsub("[/\\]", ".")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Send a notification
|
|
||||||
---@param msg string Message to send
|
|
||||||
---@param title? string Title of notification
|
|
||||||
---@param level integer Log level
|
|
||||||
local function notify(msg, title, level)
|
|
||||||
if not title then
|
|
||||||
local info = debug.getinfo(3)
|
|
||||||
local file = info.source
|
|
||||||
and (info.source:sub(1, 1) == "@" and info.source:sub(2) or info.source)
|
|
||||||
or nil
|
|
||||||
local module = file and (get_module_path(file) or file) or nil
|
|
||||||
title = module
|
|
||||||
and module .. (info.name and info.name ~= "" and ":" .. info.name or "")
|
|
||||||
or nil
|
|
||||||
end
|
|
||||||
if title and not pcall(require, "notify") then
|
|
||||||
msg = "[" .. title .. "] " .. msg
|
|
||||||
end
|
|
||||||
vim.notify(msg, level, { title = title })
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Check that an executable is available
|
--- Check that an executable is available
|
||||||
--- @param exe string Array to look for
|
--- @param exe string Array to look for
|
||||||
--- @return boolean
|
--- @return boolean
|
||||||
|
|||||||
Reference in New Issue
Block a user