refactor: refactored ui code

This commit is contained in:
Folke Lemaitre 2022-12-23 10:18:19 +01:00
parent cd023dc709
commit fde5feea6d
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
4 changed files with 238 additions and 184 deletions

View file

@ -29,10 +29,13 @@ function M.track(data, time)
end
---@param name string
---@return string
function M.normname(name)
return name:lower():gsub("^n?vim%-", ""):gsub("%.n?vim$", ""):gsub("%.lua", ""):gsub("[^a-z]+", "")
local ret = name:lower():gsub("^n?vim%-", ""):gsub("%.n?vim$", ""):gsub("%.lua", ""):gsub("[^a-z]+", "")
return ret
end
---@return string
function M.norm(path)
if path:sub(1, 1) == "~" then
local home = vim.loop.os_homedir()