Compare commits

...

2 commits

Author SHA1 Message Date
bd146ae1d8 Reuse gitsigns information 2025-02-14 21:02:24 +01:00
cf129ad7f6 Show first found LSP in lualine 2025-02-14 20:48:35 +01:00

View file

@ -4,15 +4,35 @@ local lualine = require('lualine');
local function active_lsps()
local buffer = vim.api.nvim_get_current_buf()
local client_count = #vim.lsp.get_clients({ bufnr = buffer })
local attached_clients = vim.lsp.get_clients({ bufnr = buffer })
return ('LSP: %d'):format(client_count)
if #attached_clients == 0 then return 'LSP: 0' end
local preview_client = attached_clients[1]
return ('LSP: %s (%d)'):format(preview_client.name, #attached_clients)
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
lualine.setup {
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics', active_lsps },
lualine_b = {
{'b:gitsigns_head', icon = ''},
{'diff', source = diff_source},
'diagnostics',
active_lsps
},
lualine_c = {
{
'filename',