Support git-conflict.nvim highlights
I have done the following steps before reporting this issue:
- [x] I have searched the existing issues
- [x] I have read the FAQ in the help doc
Operating system/version
macOS Tahoe
Terminal emulator/version
kitty 0.44.0
$TERM environment variable
xterm-kitty
Tmux version
No response
Feature matrix
NVIM v0.11.5 Build type: Release LuaJIT 2.1.1741730670 Run "nvim -V1 -v" for more info
Minimal vimrc that can reproduce this bug.
the placeholder one should work
Steps to reproduce this bug using minimal vimrc
- Install https://github.com/akinsho/git-conflict.nvim
- Open a file with a merge conflict.
- The ours section is unreadable.
Expected behavior
Being readable by default without having to tweak highlights.
Actual behavior
This is more of nice to have / feature request, but it would be nice if Everforest would work with it by default.
EDIT: forgot the screenshot
That looks truly horrendous 😅 Thanks for reporting 👍
Before I try this myself, how does it look with this naive customization applied?
-- init.lua (Neovim)
-- Apply custom highlights on colorscheme change.
-- Must be declared before executing ':colorscheme'.
vim.api.nvim_create_autocmd('ColorScheme', {
group = vim.api.nvim_create_augroup('custom_highlights_everforest', {}),
pattern = 'everforest',
command = 'hi link GitConflictAncestor DiffChange |' ..
'hi link GitConflictIncoming DiffAdd'
})
GitConflictIncoming links to DiffAdd, looks the same.GitConflictAncestor also looks the same but didn't seem to do anything (I see GitConflictCurrent when I do :Inspect over the first section, but I've no idea what I'm doing).
My bad. What about this then?
vim.api.nvim_create_autocmd('ColorScheme', {
group = vim.api.nvim_create_augroup('custom_highlights_everforest', {}),
pattern = 'everforest',
command = 'hi link GitConflictCurrent DiffChange'
})
Looks better, I think DiffText should also work, https://github.com/akinsho/git-conflict.nvim?tab=readme-ov-file#configuration, neither fix the heading though (the aquamarine).
It's unfortunate that the plugin defaults to DiffText, because GitConflictCurrentLabel is derived from that highlight group by tinting the background color, and Everforest's DiffText background is just too bright in this case:
When the plugin is configured with { highlights = { current = 'DiffChange' }} the result looks way nicer, but one shouldn't have to configure a plugin for a specific colorscheme:
The plugin would look better out of the box if it checked GitConflictCurrentLabel first, then fallback to DiffText as a last resort.
In the current state, we can't style GitConflictCurrentLabel like the plugin does without either
- adding a new color to Everforest's palette.
- darkening
DiffText's background.
None of those are reasonable, especially not for supporting a plugin which was last updated a year ago and is still using a few deprecated APIs.
To avoid having to configure the plugin, the best I can suggest is the autocmd approach, which is the most idiomatic way in (Neo)vim to apply coloscheme specific tweaks.
The following overrides look good without degrading the native diff mode, and adapt dynamically to your Everforest configuration:
vim.api.nvim_create_autocmd('ColorScheme', {
group = vim.api.nvim_create_augroup('custom_highlights_everforest', {}),
pattern = 'everforest',
callback = function()
local config = vim.fn['everforest#get_configuration']()
local palette = vim.fn['everforest#get_palette'](config.background, config.colors_override)
local set_hl = vim.fn['everforest#highlight']
set_hl('DiffText', palette.none, palette.bg_blue)
set_hl('DiffChange', palette.none, palette.bg3)
end
})