-- The LSP stuff is excerpt from Lunarvim local function attached_clients() local buf_clients = vim.lsp.get_active_clients { bufnr = 0 } if #buf_clients == 0 then return "LSP Inactive" end local buf_ft = vim.bo.filetype local buf_client_names = {} -- add client for _, client in pairs(buf_clients) do if client.name ~= "copilot" then table.insert(buf_client_names, client.name) end end -- Add linters (from nvim-lint) local lint_s, lint = pcall(require, "lint") if lint_s then for ft_k, ft_v in pairs(lint.linters_by_ft) do if (type(ft_v) == "table") then for _, linter in ipairs(ft_v) do if buf_ft == ft_k then table.insert(buf_client_names, linter) end end elseif type(ft_v) == "string" then if buf_ft == ft_k then table.insert(buf_client_names, ft_v) end end end end -- Add formatters (from formatter.nvim) local formatter_s, formatter = pcall(require, "formatter") if formatter_s then local formatter_config = require("formatter.config") local user_defined_formatters = formatter_config.values.filetype for formatter_filetype, formatter_functions in pairs(user_defined_formatters) do if formatter_filetype == "*" or buf_ft == formatter_filetype then for _, formatter_function in ipairs(formatter_functions) do local formatter_info = formatter_function() table.insert(buf_client_names, formatter_info.exe) end end end end local unique_client_names = table.concat(buf_client_names, ", ") local language_servers = string.format("[%s]", unique_client_names) return language_servers end return { "nvim-lualine/lualine.nvim", event = { "VimEnter", "BufReadPost", "BufNewFile" }, config = function() local lsp_component = { attached_clients, color = { gui = "bold" } } require("lualine").setup({ options = { theme = "auto", globalstatus = true, component_separators = { left = "|", right = "|" }, }, sections = { lualine_b = { "branch", "diff" }, lualine_x = { "diagnostics", lsp_component, "filetype" }, } }) end, }