SoloVim/lua/plugins/lualine.lua
Kristofers Solo 34fb80c6c4
Update 2025-05-31
Update 2025-05-03

Update 2025-05-05

Update 2025-05-07

Update 2025-05-09

chore: use mini.nvim

Update 2025-05-12

Update 2025-05-14

Update 2025-05-16

Update 2025-05-17

Update 2025-05-20

Update 2025-05-21

Update 2025-05-23

Update 2025-05-25

Update 2025-05-30
2025-06-02 13:17:36 +03:00

119 lines
2.6 KiB
Lua

--- Adds `[]` around the string
---@param str string
---@param ctx table
---@return string
local function wrap_string(str, ctx)
return "[" .. str:gsub("%s+", "") .. "]"
end
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
return {
"nvim-lualine/lualine.nvim",
event = "VimEnter",
dependencies = {
"nvim-tree/nvim-web-devicons",
{
"linrongbin16/lsp-progress.nvim",
config = function()
require("lsp-progress").setup()
end,
},
"lewis6991/gitsigns.nvim",
{
"kristoferssolo/lualine-harpoon.nvim",
-- dir = "~/repos/lualine-harpoon.nvim/",
dependencies = {
{
"ThePrimeagen/harpoon",
branch = "harpoon2",
},
},
},
"folke/noice.nvim",
},
opts = {
options = {
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
color = { bg = "" },
},
--[[ Available components
`branch` (git branch)
`buffers` (shows currently available buffers)
`diagnostics` (diagnostics count from your preferred source)
`diff` (git diff status)
`encoding` (file encoding)
`fileformat` (file format)
`filename`
`filesize`
`filetype`
`hostname`
`location` (location in file in line:column format)
`mode` (vim mode)
`progress` (%progress in file)
`searchcount` (number of search matches when hlsearch is active)
`selectioncount` (number of selected characters or lines)
`tabs` (shows currently available tabs)
`windows` (shows currently available windows) ]]
sections = {
lualine_a = {},
lualine_b = {
{ "mode", fmt = wrap_string },
{ "b:gitsigns_head", icon = "" },
},
lualine_c = {
{
"filetype",
padding = { right = 0, left = 1 },
icon_only = true,
},
{
"filename",
padding = { right = 1, left = 0 },
},
{ "diff", source = diff_source },
"harpoon",
},
lualine_x = {
{
require("noice").api.statusline.mode.get,
cond = require("noice").api.statusline.mode.has,
color = { fg = "#f6c177" },
},
function()
return require("lsp-progress").progress()
end,
"diagnostics",
},
lualine_y = {
"filesize",
{
"location",
padding = 0,
fmt = function(str, _)
return "[" .. str:gsub("%s+", "") .. " "
end,
},
{
"progress",
padding = 0,
fmt = function(str, _)
return str:gsub("%s+", "") .. "]"
end,
},
},
lualine_z = {},
},
},
}