From 9170434aa100f3967b43d5d34bb9adc56fae1986 Mon Sep 17 00:00:00 2001 From: Gennaro Tedesco Date: Fri, 31 Mar 2023 17:07:07 +0200 Subject: [PATCH] added colours to qf extension to distinguish quickfix and location list (#933) * added colours to qf extension to distinguish quickfix and location list * renamed M.init() more properly * decoupling colours assignments from init method --- lua/lualine/extensions/quickfix.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lua/lualine/extensions/quickfix.lua b/lua/lualine/extensions/quickfix.lua index 05cced5..3a64414 100644 --- a/lua/lualine/extensions/quickfix.lua +++ b/lua/lualine/extensions/quickfix.lua @@ -16,6 +16,11 @@ local function title() return vim.fn.getqflist({ title = 0 }).title end +local qf_colours = { + ll = vim.api.nvim_get_hl_by_name('Constant', false).foreground, + qf = vim.api.nvim_get_hl_by_name('Identifier', false).foreground, +} + local M = {} function M.init() @@ -24,7 +29,14 @@ function M.init() end M.sections = { - lualine_a = { label }, + lualine_a = { + { + label, + color = function() + return is_loclist() and { bg = qf_colours['ll'] } or { bg = qf_colours['qf'] } + end, + }, + }, lualine_b = { title }, lualine_z = { 'location' }, }