From ee344af9f5836b640f8cd6d956378fc53c293f20 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Thu, 13 Feb 2025 22:05:49 +0100 Subject: [PATCH] Show current attached LSP count --- templates/nvim/lua/lua-line.lua.j2 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/templates/nvim/lua/lua-line.lua.j2 b/templates/nvim/lua/lua-line.lua.j2 index 43f10c9..abec89d 100644 --- a/templates/nvim/lua/lua-line.lua.j2 +++ b/templates/nvim/lua/lua-line.lua.j2 @@ -2,11 +2,17 @@ local lualine = require('lualine'); --- TODO: show attached LSP count +local function active_lsps() + local buffer = vim.api.nvim_get_current_buf() + local client_count = #vim.lsp.get_clients({ buffer = buffer }) + + return ('LSP: %d'):format(client_count) +end + lualine.setup { sections = { lualine_a = {'mode'}, - lualine_b = {'branch', 'diff', 'diagnostics'}, + lualine_b = {'branch', 'diff', 'diagnostics', active_lsps }, lualine_c = { { 'filename',