1
0
Fork 0
mirror of https://github.com/pnx/lualine-lsp-status synced 2026-07-02 12:53:40 +02:00

adding disabled_filetypes option.

This commit is contained in:
Henrik Hautakoski 2024-09-06 17:02:12 +02:00
parent 69651df246
commit 8054e5a716
2 changed files with 10 additions and 0 deletions

View file

@ -57,6 +57,9 @@ This is the default configuration, feel free to change it to your liking.
-- true if icon should also be color coded. -- true if icon should also be color coded.
colored = true, colored = true,
-- List of filetypes to disable this component for.
disabled_filetypes = {},
-- Colors used. -- Colors used.
colors = { colors = {
-- Color used if there are one or more clients connected -- Color used if there are one or more clients connected

View file

@ -9,6 +9,9 @@ local default_options = {
-- true if icon should also be color coded. -- true if icon should also be color coded.
colored = true, colored = true,
-- List of filetypes to disable this component for.
disabled_filetypes = {},
-- Colors used. -- Colors used.
colors = { colors = {
-- Color used if there are one or more clients connected -- Color used if there are one or more clients connected
@ -74,6 +77,10 @@ end
function M:update_status() function M:update_status()
if vim.tbl_contains(self.options.disabled_filetypes or {}, vim.bo.filetype) then
return ""
end
local num_clients = #vim.tbl_keys(vim.lsp.get_clients({bufnr = 0})) local num_clients = #vim.tbl_keys(vim.lsp.get_clients({bufnr = 0}))
local status = "inactive" local status = "inactive"
if num_clients > 0 then if num_clients > 0 then