init.lua/lua/configs/statusline.lua(view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
local c = {
mode = {
function()
return " "
end,
padding = 0,
},
diagnostic = { "diagnostics", sources = { "nvim_diagnostic" } },
location = { "location", padding = 0, colored = false },
lsp = {
function()
local clients = vim.lsp.get_active_clients { bufnr = 0 }
local client_names = {}
for _, client in pairs(clients) do
if client.name ~= "null-ls" then
table.insert(client_names, client.name)
end
end
local client_names_str = table.concat(client_names, ", ")
if #client_names_str == 0 then
return ""
else
return "[" .. client_names_str .. "]"
end
end,
},
}
require("lualine").setup {
options = {
theme = "kanagawa",
globalstatus = true,
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = {
"NvimTree",
"TelescopePrompt",
"NeogitStatus",
"packer",
},
},
sections = {
lualine_a = { c.mode },
lualine_b = { "filename" },
lualine_c = { "branch", c.diagnostic },
lualine_x = { c.lsp, "diff" },
lualine_y = {},
lualine_z = { c.location },
},
}
|