neovim/lua/weeheavy/plugins/lualine.lua
2024-01-25 17:38:26 +01:00

50 lines
1.2 KiB
Lua

-- status line like vim-airline
-- Display attached LSP client
local function lsp_clients()
local clients = vim.lsp.get_active_clients()
local client_names = {}
local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
for _, client in ipairs(clients) do
local filetypes = client.config.filetypes
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
return client.name
end
end
if next(client_names) == nil then
return "no LS"
end
--return "[" .. table.concat(client_names, ", ") .. "]"
end
-- hide content on narrow windows
local function hide_in_width()
return vim.fn.winwidth(0) > 80
end
return {
"nvim-lualine/lualine.nvim",
lazy = true,
event = { "BufReadPre", "BufNewFile" },
opts = {
options = {
icons_enabled = true,
theme = "auto",
--component_separators = '⋮',
component_separators = "",
--section_separators = { left = '', right = '' },
--section_separators = { left = '', right = '' },
section_separators = { left = "", right = "" },
},
sections = {
lualine_x = {
-- specify full list of elements when adding custom things
{ "encoding" },
{ "fileformat" },
{ "filetype" },
{ lsp_clients, cond = hide_in_width },
},
},
},
}