From 3f1e9cf37a2043ab7b4a2fd25f49df43e0e1586b Mon Sep 17 00:00:00 2001 From: Akianonymus Date: Mon, 26 Jul 2021 16:57:00 +0530 Subject: [PATCH] statusline: Show lsp icon only if client is active for current buffer --- lua/plugins/statusline.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lua/plugins/statusline.lua b/lua/plugins/statusline.lua index 8f543c8c..07af61eb 100644 --- a/lua/plugins/statusline.lua +++ b/lua/plugins/statusline.lua @@ -117,7 +117,14 @@ gls.right[1] = { provider = function() local clients = vim.lsp.get_active_clients() if next(clients) ~= nil then - return " " .. "  " .. " LSP " + 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 " " .. "  " .. " LSP " + end + end + return "" else return "" end