2022-10-01 11:46:18 +00:00
|
|
|
local hide_in_width = function()
|
|
|
|
return vim.fn.winwidth(0) > 80
|
|
|
|
end
|
|
|
|
|
|
|
|
local diagnostics = {
|
|
|
|
"diagnostics",
|
|
|
|
sources = { "nvim_diagnostic" },
|
|
|
|
sections = { "error", "warn" },
|
2022-11-09 20:17:06 +00:00
|
|
|
symbols = { error = " ", warn = "!" },
|
2022-10-01 11:46:18 +00:00
|
|
|
colored = false,
|
2022-11-09 20:17:06 +00:00
|
|
|
always_visible = true,
|
2022-10-01 11:46:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
local diff = {
|
|
|
|
"diff",
|
|
|
|
colored = false,
|
2022-11-09 20:17:06 +00:00
|
|
|
symbols = { added = "+", modified = "", removed = "" },
|
2022-10-01 11:46:18 +00:00
|
|
|
cond = hide_in_width,
|
|
|
|
}
|
|
|
|
|
2022-11-09 20:17:06 +00:00
|
|
|
local lsp_progress = {
|
|
|
|
"lsp_progress",
|
|
|
|
display_components = { "spinner" },
|
2023-03-31 18:44:46 +00:00
|
|
|
spinner_symbols = { "⣷", "⣯", "⣟", "⡿", "⢿", "⣻", "⣽", "⣾" },
|
2022-10-01 11:46:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
local spaces = function()
|
2022-10-02 10:04:24 +00:00
|
|
|
local expandtab = vim.api.nvim_buf_get_option(0, "expandtab")
|
|
|
|
|
|
|
|
local title = "spaces: "
|
|
|
|
if not expandtab then
|
|
|
|
title = "tab: "
|
|
|
|
end
|
|
|
|
|
|
|
|
return title .. vim.api.nvim_buf_get_option(0, "shiftwidth")
|
2022-10-01 11:46:18 +00:00
|
|
|
end
|
|
|
|
|
2022-10-08 12:57:06 +00:00
|
|
|
local venv = function()
|
|
|
|
local venv = os.getenv("VIRTUAL_ENV")
|
|
|
|
if venv then
|
2022-11-06 19:34:46 +00:00
|
|
|
return string.format(" %s", string.match(venv, "[^/]+$"))
|
2022-10-08 12:57:06 +00:00
|
|
|
end
|
|
|
|
|
2024-02-10 15:15:03 +00:00
|
|
|
venv = require("venv-selector").get_active_venv()
|
|
|
|
if venv then
|
|
|
|
return string.format(" %s", string.match(venv, "[^/]+$"))
|
|
|
|
end
|
|
|
|
|
2022-10-08 12:57:06 +00:00
|
|
|
return ""
|
|
|
|
end
|
|
|
|
|
2023-11-03 17:48:15 +00:00
|
|
|
local get_filetype = function()
|
2023-02-15 19:19:53 +00:00
|
|
|
local ft = vim.bo.filetype or ""
|
|
|
|
|
|
|
|
if ft == "yaml" then
|
|
|
|
local schema = require("yaml-companion").get_buf_schema(0)
|
2024-02-16 15:37:22 +00:00
|
|
|
if not schema or not schema.result or not schema.result[1].name then
|
2023-11-03 17:48:15 +00:00
|
|
|
return ft
|
2023-02-15 19:19:53 +00:00
|
|
|
end
|
|
|
|
|
2023-11-03 17:48:15 +00:00
|
|
|
return ft .. " (" .. schema.result[1].name .. ")"
|
2023-02-15 19:19:53 +00:00
|
|
|
else
|
2023-11-03 17:48:15 +00:00
|
|
|
return ft
|
2023-02-15 19:19:53 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-04-12 18:09:30 +00:00
|
|
|
local gitblame = require("gitblame")
|
2022-10-01 11:46:18 +00:00
|
|
|
|
|
|
|
vim.g.gitblame_date_format = "%r"
|
|
|
|
vim.g.gitblame_display_virtual_text = 0
|
|
|
|
vim.g.gitblame_message_template = "<author>, <date>"
|
|
|
|
|
2023-04-12 18:09:30 +00:00
|
|
|
require("lualine").setup({
|
2022-10-01 11:46:18 +00:00
|
|
|
options = {
|
|
|
|
globalstatus = true,
|
|
|
|
},
|
|
|
|
sections = {
|
|
|
|
lualine_a = { "mode" },
|
2022-11-06 19:34:46 +00:00
|
|
|
lualine_b = { "branch", venv },
|
2023-09-23 10:26:32 +00:00
|
|
|
lualine_c = {
|
|
|
|
diagnostics,
|
2023-10-07 16:34:59 +00:00
|
|
|
{
|
|
|
|
"filename",
|
|
|
|
path = 1,
|
|
|
|
cond = function()
|
2023-10-20 15:44:59 +00:00
|
|
|
if
|
|
|
|
vim.bo.filetype == "neo-tree"
|
|
|
|
or vim.bo.filetype == "mason"
|
|
|
|
or vim.bo.filetype == "lazy"
|
|
|
|
or vim.bo.filetype == "help"
|
|
|
|
or vim.bo.filetype == "starter"
|
|
|
|
or vim.bo.filetype == "TelescopePrompt"
|
|
|
|
or vim.bo.filetype == "noice"
|
|
|
|
then
|
2023-10-07 16:34:59 +00:00
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
|
|
|
return true
|
2023-10-08 18:01:33 +00:00
|
|
|
end,
|
2023-10-07 16:34:59 +00:00
|
|
|
},
|
2024-02-16 15:37:22 +00:00
|
|
|
{
|
|
|
|
"copilot",
|
|
|
|
symbols = {
|
|
|
|
status = {
|
|
|
|
icons = {
|
|
|
|
enabled = " ",
|
|
|
|
sleep = " ",
|
|
|
|
disabled = " ",
|
|
|
|
warning = " ",
|
|
|
|
unknown = " ",
|
|
|
|
},
|
|
|
|
},
|
2024-02-22 16:52:44 +00:00
|
|
|
spinners = require("copilot-lualine.spinners").dots,
|
2024-02-16 15:37:22 +00:00
|
|
|
},
|
|
|
|
},
|
2023-09-26 16:03:34 +00:00
|
|
|
lsp_progress,
|
2023-09-23 10:26:32 +00:00
|
|
|
{
|
|
|
|
require("noice").api.status.search.get,
|
|
|
|
cond = require("noice").api.status.search.has,
|
|
|
|
color = { fg = "#c69026" },
|
|
|
|
},
|
|
|
|
},
|
2022-10-01 11:46:18 +00:00
|
|
|
lualine_x = {
|
|
|
|
{ gitblame.get_current_blame_text, cond = gitblame.is_blame_text_available },
|
|
|
|
diff,
|
|
|
|
spaces,
|
|
|
|
"encoding",
|
2023-11-03 17:48:15 +00:00
|
|
|
{ get_filetype, separator = "" },
|
2022-10-01 11:46:18 +00:00
|
|
|
},
|
2022-11-09 20:17:06 +00:00
|
|
|
lualine_y = { "progress" },
|
|
|
|
lualine_z = { "location" },
|
2022-10-01 11:46:18 +00:00
|
|
|
},
|
2023-10-20 15:44:59 +00:00
|
|
|
extensions = { "lazy", "mason", "trouble" },
|
2022-10-01 11:46:18 +00:00
|
|
|
})
|