189 lines
4.4 KiB
Lua
189 lines
4.4 KiB
Lua
return {
|
|
"nvim-lualine/lualine.nvim",
|
|
lazy = false,
|
|
dependencies = {
|
|
"nvim-tree/nvim-web-devicons",
|
|
"cbochs/grapple.nvim",
|
|
{ 'AndreM222/copilot-lualine' }
|
|
},
|
|
opts = function()
|
|
local icons = require("aleidk.constants").icons
|
|
local palete = require("catppuccin.palettes").get_palette "macchiato"
|
|
|
|
local function diff_source()
|
|
local gitsigns = vim.b.gitsigns_status_dict
|
|
if gitsigns then
|
|
return {
|
|
added = gitsigns.added,
|
|
modified = gitsigns.changed,
|
|
removed = gitsigns.removed,
|
|
}
|
|
end
|
|
end
|
|
|
|
local function position_scrollbar(str)
|
|
local sbar = { "▁▁", "▂▂", "▃▃", "▄▄", "▅▅", "▆▆", "▇▇", "██" }
|
|
|
|
local curr_line = vim.api.nvim_win_get_cursor(0)[1]
|
|
local lines = vim.api.nvim_buf_line_count(0)
|
|
local i = math.floor((curr_line - 1) / lines * #sbar) + 1
|
|
return str .. " " .. sbar[i]
|
|
end
|
|
|
|
local codecompanion_status = require("lualine.component"):extend()
|
|
|
|
codecompanion_status.processing = false
|
|
codecompanion_status.spinner_index = 1
|
|
|
|
local spinner_symbols = require("copilot-lualine.spinners").bouncing_bar
|
|
|
|
-- Initializer
|
|
function codecompanion_status:init(options)
|
|
codecompanion_status.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 codecompanion_status:update_status()
|
|
if self.processing then
|
|
self.spinner_index = (self.spinner_index % #spinner_symbols) + 1
|
|
return spinner_symbols[self.spinner_index]
|
|
else
|
|
return nil
|
|
end
|
|
end
|
|
|
|
return {
|
|
options = {
|
|
theme = "catppuccin",
|
|
globalstatus = true,
|
|
disabled_filetypes = { statusline = { "dashboard", "alpha" } },
|
|
component_separators = "",
|
|
section_separators = "",
|
|
},
|
|
sections = {
|
|
lualine_a = {
|
|
{
|
|
"mode",
|
|
padding = 0,
|
|
fmt = function()
|
|
return " "
|
|
end,
|
|
},
|
|
},
|
|
lualine_b = {},
|
|
lualine_c = {
|
|
{ "branch", icon = icons.git.branch },
|
|
{
|
|
"diff",
|
|
symbols = {
|
|
added = icons.git.added,
|
|
modified = icons.git.modified,
|
|
removed = icons.git.removed,
|
|
},
|
|
source = diff_source,
|
|
},
|
|
{ codecompanion_status },
|
|
{
|
|
"diagnostics",
|
|
symbols = {
|
|
error = icons.diagnostics.Error,
|
|
warn = icons.diagnostics.Warn,
|
|
info = icons.diagnostics.Info,
|
|
hint = icons.diagnostics.Hint,
|
|
},
|
|
},
|
|
"filetype",
|
|
{
|
|
"filename",
|
|
path = 1,
|
|
symbols = {
|
|
modified = "●", -- Text to show when the buffer is modified
|
|
alternate_file = "#", -- Text to show to identify the alternate file
|
|
directory = "", -- Text to show when the buffer is a directory
|
|
},
|
|
},
|
|
},
|
|
lualine_x = {
|
|
{
|
|
"overseer",
|
|
},
|
|
{
|
|
function()
|
|
return require("grapple").statusline()
|
|
end,
|
|
},
|
|
{
|
|
"copilot",
|
|
cond = function()
|
|
return vim.bo.filetype ~= "codecompanion"
|
|
end,
|
|
show_colors = true,
|
|
symbols = {
|
|
status = {
|
|
icons = {
|
|
enabled = " ",
|
|
sleep = " ", -- auto-trigger disabled
|
|
disabled = " ",
|
|
warning = " ",
|
|
unknown = " "
|
|
},
|
|
hl = {
|
|
enabled = palete.teal,
|
|
sleep = palete.lavender,
|
|
disabled = palete.subtext0,
|
|
warning = palete.peach,
|
|
unknown = palete.red
|
|
}
|
|
},
|
|
spinners = spinner_symbols,
|
|
spinner_color = palete.mauve
|
|
},
|
|
},
|
|
},
|
|
lualine_y = {
|
|
{
|
|
-- Macro recording status
|
|
function()
|
|
return require("noice").api.status.mode.get()
|
|
end,
|
|
cond = function()
|
|
return package.loaded["noice"] and require("noice").api.status.mode.has()
|
|
end,
|
|
},
|
|
{ "searchcount" },
|
|
{ "location" },
|
|
{
|
|
"progress",
|
|
fmt = position_scrollbar,
|
|
separator = " ",
|
|
padding = 0,
|
|
},
|
|
},
|
|
lualine_z = {},
|
|
},
|
|
extensions = {
|
|
"lazy",
|
|
"fzf",
|
|
"man",
|
|
"mason",
|
|
"quickfix",
|
|
"trouble",
|
|
"toggleterm",
|
|
},
|
|
}
|
|
end,
|
|
}
|