🪴 a tiny, customizable statusline for neovim
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf: only reload mode reverse hl on colorscheme

robin 5e933b29 5daeae02

+15 -15
+5 -7
lua/lylla/init.lua
··· 32 32 33 33 function M.inithls() 34 34 vim.iter(pairs(default_hls)):each(function(mode, defaulthl) 35 - local name = utils.get_modehl_name(mode) 36 - 37 35 local hl = config.get().hls[mode] 36 + local name, revname = utils.get_modehl_name(mode) 38 37 if hl then 39 38 vim.api.nvim_set_hl(0, name, hl) 40 - return 41 - end 42 - 43 - if vim.tbl_isempty(vim.api.nvim_get_hl(0, { name = name })) then 39 + elseif vim.tbl_isempty(vim.api.nvim_get_hl(0, { name = name })) then 44 40 vim.api.nvim_set_hl(0, name, defaulthl) 45 41 end 42 + vim.api.nvim_set_hl(0, revname, utils.reverse_hl(name)) 46 43 end) 47 44 end 48 45 49 46 function M.resethl() 50 47 vim.iter(pairs(default_hls)):each(function(mode, _) 51 - local name = utils.get_modehl_name(mode) 48 + local name, revname = utils.get_modehl_name(mode) 52 49 vim.api.nvim_set_hl(0, name, {}) 50 + vim.api.nvim_set_hl(0, revname, {}) 53 51 end) 54 52 end 55 53
+10 -8
lua/lylla/utils.lua
··· 207 207 208 208 ---@param mode string 209 209 ---@return string 210 + ---@return string 210 211 function utils.get_modehl_name(mode) 211 - return "@lylla." .. mode 212 + return "@lylla." .. mode, string.format("@lylla.%s.rev", mode) 212 213 end 213 214 214 215 ---@return string 216 + ---@return string 215 217 function utils.get_modehl() 216 218 local mode = vim.api.nvim_get_mode().mode 217 - local hl_name = utils.get_modehl_name("normal") 219 + local modename = "normal" 218 220 219 221 if string.match(mode, "^[vVs]") then 220 - hl_name = utils.get_modehl_name("visual") 222 + modename = "visual" 221 223 elseif string.match(mode, "^c") then 222 - hl_name = utils.get_modehl_name("command") 224 + modename = "command" 223 225 elseif string.match(mode, "^[it]") then 224 - hl_name = utils.get_modehl_name("insert") 226 + modename = "insert" 225 227 elseif string.match(mode, "^[rR]") then 226 - hl_name = utils.get_modehl_name("replace") 228 + modename = "replace" 227 229 elseif string.match(mode, "^%ao") then 228 - hl_name = utils.get_modehl_name("operator") 230 + modename = "operator" 229 231 end 230 232 231 - return hl_name, utils.create_hl(utils.reverse_hl(hl_name)) 233 + return utils.get_modehl_name(modename) 232 234 end 233 235 234 236 return utils