-
Hello, I've got this hack working in other to share highlights between |
Beta Was this translation helpful? Give feedback.
Answered by
rebelot
May 10, 2022
Replies: 1 comment 1 reply
-
this works, but the safest/easiest thing would be to make mode_color accessible to the whole statusline like this: local StatusLines = {
hl = function()
if conditions.is_active() then
return {
fg = utils.get_highlight("StatusLine").fg,
bg = utils.get_highlight("StatusLine").bg,
}
else
return {
fg = utils.get_highlight("StatusLineNC").fg,
bg = utils.get_highlight("StatusLineNC").bg,
}
end
end,
static = {
mode_color = function()
local mode_colors = {
n = colors.red,
i = colors.green,
v = colors.cyan,
V = colors.cyan,
["\22"] = colors.cyan, -- this is an actual ^V, type <C-v><C-v> in insert mode
c = colors.orange,
s = colors.purple,
S = colors.purple,
["\19"] = colors.purple, -- this is an actual ^S, type <C-v><C-s> in insert mode
R = colors.orange,
r = colors.orange,
["!"] = colors.red,
t = colors.red,
}
return mode_colors[vim.fn.mode()]
end,
},
init = utils.pick_child_on_condition,
SpecialStatusline,
TerminalStatusline,
InactiveStatusline,
DefaultStatusline,
} then you can use surround like this utils.surround({ "", "" }, function(self)
return self.mode_color()
end, Ruler), Of course you can remove the local ViMode = {
...
hl = function(self)
local color = self.mode_color()
return { fg = color, bold = true }
end
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
nxmxsxs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this works, but the safest/easiest thing would be to make mode_color accessible to the whole statusline like this: