馃 a tiny, customizable statusline for neovim
1local components = {}
2
3---@param props { buffer?: integer, limit?: integer, sep?: string, filter?: fun(client: vim.lsp.Client): boolean }
4---@return string?
5function components.lsp_clients(props)
6 props = props or {}
7 local buffer = props.buffer or 0
8
9 local clients = vim
10 .iter(vim.lsp.get_clients({ bufnr = buffer }))
11 :map(function(
12 client --[[@as vim.lsp.Client]]
13 )
14 if props.filter and not props.filter(client) then
15 return
16 end
17 return client.config.name
18 end)
19 :totable()
20
21 if #clients == 0 then
22 return
23 end
24
25 return table.concat(clients, props.sep or " + ", 1, vim.F.if_nil(props.limit))
26end
27
28return components