✨ feat(nvim): add lsp client module for lualine
This commit is contained in:
parent
a1c64a76c9
commit
c6912fb80f
1 changed files with 22 additions and 0 deletions
|
@ -1,3 +1,24 @@
|
||||||
|
local lsp = function()
|
||||||
|
local buf_clients = vim.lsp.get_active_clients({ bufnr = 0 })
|
||||||
|
if #buf_clients == 0 then
|
||||||
|
return "LSP Inactive"
|
||||||
|
end
|
||||||
|
|
||||||
|
local buf_client_names = {}
|
||||||
|
|
||||||
|
-- add client
|
||||||
|
for _, client in pairs(buf_clients) do
|
||||||
|
if client.name ~= "null-ls" and client.name ~= "copilot" then
|
||||||
|
table.insert(buf_client_names, client.name)
|
||||||
|
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 {
|
return {
|
||||||
"nvim-lualine/lualine.nvim",
|
"nvim-lualine/lualine.nvim",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
|
@ -5,6 +26,7 @@ return {
|
||||||
opts.options.section_separators = { left = "", right = "" }
|
opts.options.section_separators = { left = "", right = "" }
|
||||||
|
|
||||||
table.remove(opts.sections.lualine_x, 1)
|
table.remove(opts.sections.lualine_x, 1)
|
||||||
|
table.insert(opts.sections.lualine_x, 2, lsp)
|
||||||
opts.sections.lualine_a = { { "mode", icon = "" } }
|
opts.sections.lualine_a = { { "mode", icon = "" } }
|
||||||
opts.sections.lualine_y = { { "progress", icon = "", separator = " ", padding = { left = 1, right = 1 } } }
|
opts.sections.lualine_y = { { "progress", icon = "", separator = " ", padding = { left = 1, right = 1 } } }
|
||||||
opts.sections.lualine_z = { { "location", icon = "", padding = { left = 1, right = 1 } } }
|
opts.sections.lualine_z = { { "location", icon = "", padding = { left = 1, right = 1 } } }
|
||||||
|
|
Loading…
Add table
Reference in a new issue