Closed itzaeon closed 1 year ago
@itzaeon Thank you very much for your PR! I have just a couple of minor things to comment on.
I think I might prefer if the configuration API looked like this:
{
highlights = {
modes = {
['i'] = {
color = colors.insert,
bold = false,
italic = false,
},
['v'] = {
color = colors.visual,
bold = false,
italic = false,
},
['V'] = {
color = colors.visual,
bold = false,
italic = false,
},
[''] = {
color = colors.visual,
bold = false,
italic = false,
},
['s'] = {
color = colors.select,
bold = false,
italic = false,
},
['S'] = {
color = colors.select,
bold = false,
italic = false,
},
['R'] = {
color = colors.replace,
bold = false,
italic = false,
},
['c'] = {
color = colors.command,
bold = false,
italic = false,
},
}
}
}
since in Neovim, the "highlght" includes italic/bold. Or what do you think? Or do you think that would make it more confusing the user to include italic/bold under the highlights
table?
A quick summary of my changes:
options
:
overrides
, which one can use to set every mode to bold/italicoptions.highlights.modes
as shown in the above commentM.setup
:
has_overrides
- if the user has given overridesM.set_format
:
options
keys, removed the call to vim.tbl_extend
as it wasn't necessary anymoreI also added the updated options
keys to config, as well as how to install with lazy.nvim.
@itzaeon Nice! However, now there's no highlight except for in normal mode for me. If I go to insert/visual/replace/etc. mode the line number indicator gets the foreground color of Nomal
(white for me). Do you have the same issue?
I believe I know why you experience this behavior. The two colorschemes I use are zephyr and oxocarbon. This plugin works "as designed" when I use zephyr
as my scheme, but not when I use oxocarbon
.
Highlights with zephyr
:
CursorLineNr
(normal mode): guifg=#61afefQuestion
(insert mode): guifg=#f7bb3bType
(visual mode): guifg=#1abc9cAnd with oxocarbon
:
CursorLineNr
(normal mode): guifg=#d0d0d0Question
(insert mode): guifg=#d0d0d0Type
(visual mode): guifg=#78a9ffNote that with oxocarbon
, both CursorLineNr
and Question
have the same value. I see the same behavior that you do. With zephyr
, since CursorLineNr/Question/Type are all different, the plugin works as intended.
I see two options to fix this. 1) We can define highlight groups specifically for modicator (ie ModicatorNormalHighlight, ModicatorInsertHighlight) or 2) a new function can be added that finds different highlights for each mode.
@itzaeon I'm not sure that's the issue I'm seeing since I explicitly set the colors in my config. I get the same problem with the following test config on your branch:
use { 'melkster/modicator.nvim',
config = function()
require('modicator').setup({
highlights = {
modes = {
['i'] = 'red',
['v'] = 'green',
['V'] = 'blue',
[''] = 'blue',
['s'] = 'yellow',
['S'] = 'brown',
['R'] = 'pink',
['c'] = 'orange',
}
},
})
end
}
@mawkler That config won't work because it was changed here. I get the same behavior using that config, but because the config options have changed in accordance with your comment, something like this should work:
use { 'melkster/modicator.nvim',
config = function()
require('modicator').setup({
highlights = {
modes = {
['n'] = { color = 'orange' },
['i'] = { color = 'red' },
['v'] = { color = 'green' },
['V'] = { color = 'blue' },
['�'] = { color = 'blue' },
['s'] = { color = 'yellow' },
['S'] = { color = 'brown' },
['R'] = { color = 'pink' },
['c'] = { color = 'orange' },
}
},
})
end
}
@itzaeon Of course! You're right, that's my bad.
Those should work.
Done!
Awesome! Thank you very much for your contributing! 😄
@itzaeon Note that I just changed the name of the option color
to foreground
in 26338f79329e0659b5c4bd7909816f95a715b6ca to make it more coherent with Neovim's vim.api.nvim_set_hl()
. I also added a background
option.
I added the option to format line numbers with bold or italics. I changed the name of your function
M.set_highlight
toM.set_highlight_and_format
with a new parameterformat
.Note: I haven't seen the syntax
---@param color string
before, so you might have to update that for the newformat
parameter.