From 3bc52f9988a58e3e1a2a48ee2299383d967a1573 Mon Sep 17 00:00:00 2001 From: Myles Mo <54089360+emxxjnm@users.noreply.github.com> Date: Tue, 9 Aug 2022 19:32:35 +0800 Subject: fix(lualine): set icon color according to the status of treesitter (#2754) Co-authored-by: emxxjnm --- lua/lvim/core/lualine/components.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lua') diff --git a/lua/lvim/core/lualine/components.lua b/lua/lvim/core/lualine/components.lua index 49a8ff81..5095cfb4 100644 --- a/lua/lvim/core/lualine/components.lua +++ b/lua/lvim/core/lualine/components.lua @@ -70,13 +70,13 @@ return { }, treesitter = { function() - local b = vim.api.nvim_get_current_buf() - if next(vim.treesitter.highlighter.active[b]) then - return "" - end - return "" + return "" + end, + color = function() + local buf = vim.api.nvim_get_current_buf() + local ts = vim.treesitter.highlighter.active[buf] + return { fg = ts and not vim.tbl_isempty(ts) and colors.green or colors.red } end, - color = { fg = colors.green }, cond = conditions.hide_in_width, }, lsp = { -- cgit v1.2.3