Skip to content

Commit

Permalink
use the latest fidget spinner
Browse files Browse the repository at this point in the history
Signed-off-by: abzcoding <abzcoding@gmail.com>
  • Loading branch information
abzcoding committed Jun 3, 2024
1 parent fc8962d commit 6c6bdeb
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 70 deletions.
130 changes: 61 additions & 69 deletions lua/user/fidget_spinner.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,80 +5,72 @@ M.config = function()
if not status_ok then
return
end
local relative = "editor"
if lvim.builtin.global_statusline then
relative = "win"
end

fidget.setup {
text = {
spinner = {
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
progress = {
poll_rate = 0,
suppress_on_insert = false,
ignore_done_already = false,
ignore_empty_message = true,
ignore = { "null-ls", "none-ls" },

display = {
done_icon = "",
done_style = "Constant",
progress_icon = {
pattern = {
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
},
period = 1,
},
format_message = function(msg)
local message = msg.message
if not message then
message = msg.done and "" or ""
end
if msg.percentage ~= nil then
message = string.format("%s (%.0f%%)", message, msg.percentage)
end
return message
end,
},
done = "", -- character shown when all tasks are complete
commenced = "", -- message shown when task starts
completed = "", -- message shown when task completes
},
align = {
bottom = true, -- align fidgets along bottom edge of buffer
right = true, -- align fidgets along right edge of buffer
},
timer = {
spinner_rate = 100, -- frame rate of spinner animation, in ms
fidget_decay = 500, -- how long to keep around empty fidget, in ms
task_decay = 300, -- how long to keep around completed task, in ms
},
window = {
relative = relative, -- where to anchor the window, either `"win"` or `"editor"`
blend = 100, -- `&winblend` for the window
zindex = nil, -- the `zindex` value for the window
},
fmt = {
leftpad = true, -- right-justify text in fidget box
stack_upwards = true, -- list of tasks grows upwards
max_width = 0, -- maximum width of the fidget box
-- function to format fidget title
fidget = function(fidget_name, spinner)
return string.format("%s %s", spinner, fidget_name)
end,
-- function to format each task line
task = function(task_name, message, percentage)
return string.format("%s%s [%s]", message, percentage and string.format(" (%s%%)", percentage) or "", task_name)
end,
},
sources = {
["null-ls"] = { ignore = true },
notification = {
window = {
winblend = 0,
},
},
debug = {
logging = false, -- whether to enable logging, for debugging
strict = false, -- whether to interpret LSP strictly
integration = {
["nvim-tree"] = {
enable = lvim.builtin.tree_provider == "nvimtree",
},
},
}
end
Expand Down
2 changes: 1 addition & 1 deletion lua/user/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ M.config = function()
},
{
"j-hui/fidget.nvim",
branch = "legacy",
-- branch = "legacy",
config = function()
require("user.fidget_spinner").config()
end,
Expand Down

0 comments on commit 6c6bdeb

Please sign in to comment.