use nerdfont glyphs for lsp progress spinners

This commit is contained in:
siduck76 2021-08-27 09:58:54 +05:30
parent f7ff16e84e
commit 97e155f3a2
1 changed files with 15 additions and 10 deletions

View File

@ -181,20 +181,25 @@ components.mid.active[1] = {
local percentage = Lsp.percentage or 0 local percentage = Lsp.percentage or 0
local title = Lsp.title or "" local title = Lsp.title or ""
local spinners = { local spinners = {
"󰝦", "",
"󰪞", "",
"󰪟", "",
"󰪠", }
"󰪡",
"󰪢", local success_icon = {
"󰪣", "",
"󰪤", "",
"󰪥", "",
} }
local ms = vim.loop.hrtime() / 1000000 local ms = vim.loop.hrtime() / 1000000
local frame = math.floor(ms / 120) % #spinners local frame = math.floor(ms / 120) % #spinners
return string.format(" %%<%s %s %s (%s%%%%) ", spinners[frame + 1], title, msg, percentage)
if percentage >= 70 then
return string.format(" %%<%s %s %s (%s%%%%) ", success_icon[frame + 1], title, msg, percentage)
else
return string.format(" %%<%s %s %s (%s%%%%) ", spinners[frame + 1], title, msg, percentage)
end
end end
return "" return ""
end, end,