diff --git a/README.md b/README.md index 54ca887..9bd1f68 100644 --- a/README.md +++ b/README.md @@ -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. colored = true, + -- List of filetypes to disable this component for. + disabled_filetypes = {}, + -- Colors used. colors = { -- Color used if there are one or more clients connected diff --git a/lua/lualine/components/lsp-status.lua b/lua/lualine/components/lsp-status.lua index d86c47a..8dcde50 100644 --- a/lua/lualine/components/lsp-status.lua +++ b/lua/lualine/components/lsp-status.lua @@ -9,6 +9,9 @@ local default_options = { -- true if icon should also be color coded. colored = true, + -- List of filetypes to disable this component for. + disabled_filetypes = {}, + -- Colors used. colors = { -- Color used if there are one or more clients connected @@ -74,6 +77,10 @@ end 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 status = "inactive" if num_clients > 0 then