enable color for copilot lualine

This commit is contained in:
sudacode 2025-02-16 16:55:19 -08:00
parent 03701f3616
commit 19567ee2b5
Signed by: sudacode
SSH Key Fingerprint: SHA256:lT5C2bB398DcX6daCF/gYFNSTK3y+Du3oTGUnYzfTEw

View File

@ -1,137 +1,137 @@
return { return {
"nvim-lualine/lualine.nvim", "nvim-lualine/lualine.nvim",
config = function() config = function()
local M = require("lualine.component"):extend() local M = require("lualine.component"):extend()
M.processing = false M.processing = false
M.spinner_index = 1 M.spinner_index = 1
local spinner_symbols = { local spinner_symbols = {
"", "",
"", "",
"", "",
"", "",
"", "",
"", "",
"", "",
"", "",
"", "",
"", "",
} }
local spinner_symbols_len = 10 local spinner_symbols_len = 10
-- Initializer -- Initializer
function M:init(options) function M:init(options)
M.super.init(self, options) M.super.init(self, options)
local group = vim.api.nvim_create_augroup("CodeCompanionHooks", {}) local group = vim.api.nvim_create_augroup("CodeCompanionHooks", {})
vim.api.nvim_create_autocmd({ "User" }, { vim.api.nvim_create_autocmd({ "User" }, {
pattern = "CodeCompanionRequest*", pattern = "CodeCompanionRequest*",
group = group, group = group,
callback = function(request) callback = function(request)
if request.match == "CodeCompanionRequestStarted" then if request.match == "CodeCompanionRequestStarted" then
self.processing = true self.processing = true
elseif request.match == "CodeCompanionRequestFinished" then elseif request.match == "CodeCompanionRequestFinished" then
self.processing = false self.processing = false
end end
end, end,
}) })
end end
-- Function that runs every time statusline is updated -- Function that runs every time statusline is updated
function M:update_status() function M:update_status()
if self.processing then if self.processing then
self.spinner_index = (self.spinner_index % spinner_symbols_len) + 1 self.spinner_index = (self.spinner_index % spinner_symbols_len) + 1
return spinner_symbols[self.spinner_index] return spinner_symbols[self.spinner_index]
else else
return nil return nil
end end
end end
require('lualine').setup({ require("lualine").setup({
options = { options = {
icons_enabled = true, icons_enabled = true,
theme = "catppuccin", theme = "catppuccin",
-- theme = 'dracula', -- theme = 'dracula',
-- theme = 'horizon', -- theme = 'horizon',
-- theme = 'onedark', -- theme = 'onedark',
component_separators = { left = "", right = "" }, component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" }, section_separators = { left = "", right = "" },
disabled_filetypes = {}, disabled_filetypes = {},
always_divide_middle = true, always_divide_middle = true,
}, },
sections = { sections = {
lualine_a = { "mode" }, lualine_a = { "mode" },
lualine_b = { "branch", "diff" }, lualine_b = { "branch", "diff" },
lualine_c = { "filename" }, lualine_c = { "filename" },
lualine_x = { lualine_x = {
M, M,
{ {
"copilot", "copilot",
symbols = { symbols = {
status = { status = {
icons = { icons = {
enabled = "", enabled = "",
sleep = "", -- auto-trigger disabled sleep = "", -- auto-trigger disabled
disabled = "", disabled = "",
warning = "", warning = "",
unknown = "", unknown = "",
}, },
hl = { hl = {
enabled = "#50FA7B", enabled = "#50FA7B",
sleep = "#AEB7D0", sleep = "#AEB7D0",
disabled = "#6272A4", disabled = "#6272A4",
warning = "#FFB86C", warning = "#FFB86C",
unknown = "#FF5555", unknown = "#FF5555",
}, },
}, },
spinners = "dots", -- has some premade spinners spinners = "dots", -- has some premade spinners
spinner_color = "#6272A4", spinner_color = "#6272A4",
}, },
show_colors = false, show_colors = true,
show_loading = true, show_loading = true,
}, },
{ {
"diagnostics", "diagnostics",
"fileformat", "fileformat",
symbols = { symbols = {
unix = "", -- e712 unix = "", -- e712
dos = "", -- e70f dos = "", -- e70f
mac = "", -- e711 mac = "", -- e711
}, },
}, },
"encoding", "encoding",
"fileformat", "fileformat",
{ "filetype", colored = true, icon_only = false }, { "filetype", colored = true, icon_only = false },
}, },
lualine_y = { "progress" }, lualine_y = { "progress" },
lualine_z = { "location" }, lualine_z = { "location" },
}, },
inactive_sections = { inactive_sections = {
lualine_a = {}, lualine_a = {},
lualine_b = {}, lualine_b = {},
lualine_c = { lualine_c = {
{ {
"filename", "filename",
file_status = true, -- Displays file status (readonly status, modified status) file_status = true, -- Displays file status (readonly status, modified status)
path = 0, -- 0: Just the filename path = 0, -- 0: Just the filename
shorting_target = 40, -- Shortens path to leave 40 spaces in the window shorting_target = 40, -- Shortens path to leave 40 spaces in the window
symbols = { symbols = {
modified = "[+]", -- Text to show when the file is modified. modified = "[+]", -- Text to show when the file is modified.
readonly = "[-]", -- Text to show when the file is non-modifiable or readonly. readonly = "[-]", -- Text to show when the file is non-modifiable or readonly.
unnamed = "[No Name]", -- Text to show for unnamed buffers. unnamed = "[No Name]", -- Text to show for unnamed buffers.
}, },
}, },
M, M,
}, },
lualine_x = { "location" }, lualine_x = { "location" },
lualine_y = {}, lualine_y = {},
lualine_z = {}, lualine_z = {},
}, },
tabline = {}, tabline = {},
extensions = { "quickfix", "fzf", "nvim-tree", "symbols-outline", "fugitive" }, extensions = { "quickfix", "fzf", "nvim-tree", "symbols-outline", "fugitive" },
}) })
end, end,
depends = { "kyazdani42/nvim-web-devicons" }, depends = { "kyazdani42/nvim-web-devicons" },
} }