help: cannot change tthe color and style of MatchParen group
halshar opened this issue · comments
Neovim version (nvim -v)
v0.9.2
Operating system/version
Fedora Linux - 38
Describe the bug
I'm trying to change the MatchParen color for the carbonfox them but i'm not seeing any changes
return {
"EdenEast/nightfox.nvim",
lazy = false,
priority = 1000,
config = function()
require("nightfox").setup({
options = {
groups = {
carbonfox = {
MatchParen = { fg = "yellow" },
},
},
},
})
vim.cmd("colorscheme carbonfox")
end,
}
Steps To Reproduce
- copy the config
- go over any parenthesis
Expected Behavior
what I want is for the opening and closing parenthesis to have the same block and color, in the above config I was trying with yellow but I don't see any changes
Repro
No response
Looking at the setup call you have the groups
table nested inside the options
table. The correct table would be:
require("nightfox").setup({
options = {
-- ...
},
groups = {
carbonfox = {
MatchParen = { fg = "yellow" },
},
},
})
thank you, it works but how do I make both the highlight be a block of same color i.e purple color of the carbonfox theme?
Not sure I understand the question. Which highlight groups are you referring to? Or do you mean inverting the highlight group so the background is magenta and the foreground is the background?
no, what I mean is I want the opening and the closing parenthesis to be have cursor blocks
the first screenshot is of the default theme and the second is of carbonfox
The 'cursor block' you are referring to it just setting the background color (the default is: MatchParen MatchParen xxx ctermbg=6 guibg=DarkCyan
).
Option 1
Set the foreground and background of the MatchParen
highlight group.
require("nightfox").setup({
groups = {
all = {
MatchParen = { bg = "palette.yellow", fg = "bg1" },
},
},
})
Option 2
Use the reverse
style for MatchParen
which reverses the foreground and background (see :h attr-list
for list of styles)
require("nightfox").setup({
groups = {
all = {
MatchParen = { fg = "palette.cyan", style = "reverse" },
},
},
})
Option 3
Use builtin shortcut in nightfox for reverse the match parens with options.inverse.match_paren = true
.
require("nightfox").setup({
options = {
inverse = {
match_paren = true,
},
},
groups = {
all = {
MatchParen = { fg = "palette.cyan" },
},
},
})
Note
For the groups
table it uses the spec
table. If you want to refer to a palette color, prefix with palette.
.
I tried all 3 methods and setting the inverse makes the closing parenthesis highlight instead of the opening one, but what I want is for both the opening and closing parenthesis to be highlighted and having a block, is this possible?
Neovim can only set the highlight for the matched pairs. As pairs are highlighted based on your cursor's position it requires one of the pairs to be behind your cursor. Neovim does not control the cursor that is handled by your terminal. That is something you would have to consult your terminals cursor settings.
For example alacritty's default cursor swaps the cells forground and background for the cursor. And wezterm sets the color statically.
Yes from the image that you provided your cursor is reversing the cell. I am guessing that you are using alacritty, (as that is the default behaviour). They both look like blocks because they are both different colors then the background color.
The default highlight only sets the background color and does not set a foreground color.
For example setting MatchParen to
MatchParen = { fg = "", bg = "palette.cyan" },
Would result in the following in alacritty:
And the same line with a different foreground color (commented)
And the same as the above but in wezterm
thanks a lot, this works and sorry for all the trouble :)