Adding spinny animation to lualine when LLM is running
This commit is contained in:
parent
44b6da6df3
commit
abfaa668f2
@ -1,8 +1,61 @@
|
|||||||
require('lualine').setup {
|
|
||||||
options = {
|
local M = require("lualine.component"):extend()
|
||||||
theme = "catppuccin"
|
|
||||||
-- theme = "citruszest"
|
M.processing = false
|
||||||
-- theme = "onedark"
|
M.spinner_index = 1
|
||||||
-- ... the rest of your lualine config
|
|
||||||
}
|
local spinner_symbols = {
|
||||||
|
"⠋",
|
||||||
|
"⠙",
|
||||||
|
"⠹",
|
||||||
|
"⠸",
|
||||||
|
"⠼",
|
||||||
|
"⠴",
|
||||||
|
"⠦",
|
||||||
|
"⠧",
|
||||||
|
"⠇",
|
||||||
|
"⠏",
|
||||||
}
|
}
|
||||||
|
local spinner_symbols_len = 10
|
||||||
|
|
||||||
|
-- Initializer
|
||||||
|
function M:init(options)
|
||||||
|
M.super.init(self, options)
|
||||||
|
|
||||||
|
local group = vim.api.nvim_create_augroup("CodeCompanionHooks", {})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd({ "User" }, {
|
||||||
|
pattern = "CodeCompanionRequest*",
|
||||||
|
group = group,
|
||||||
|
callback = function(request)
|
||||||
|
if request.match == "CodeCompanionRequestStarted" then
|
||||||
|
self.processing = true
|
||||||
|
elseif request.match == "CodeCompanionRequestFinished" then
|
||||||
|
self.processing = false
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Function that runs every time statusline is updated
|
||||||
|
function M:update_status()
|
||||||
|
if self.processing then
|
||||||
|
self.spinner_index = (self.spinner_index % spinner_symbols_len) + 1
|
||||||
|
return spinner_symbols[self.spinner_index]
|
||||||
|
else
|
||||||
|
return require('lualine.components.location')()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
require('lualine').setup {
|
||||||
|
sections = {
|
||||||
|
lualine_z = {M}
|
||||||
|
},
|
||||||
|
options = {
|
||||||
|
theme = "catppuccin"
|
||||||
|
-- theme = "citruszest"
|
||||||
|
-- theme = "onedark"
|
||||||
|
-- ... the rest of your lualine config
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user