[Bug] win options clobbered (`winhl`), not set (`winblend`)
Description
Leaving and coming back to the diffview tab, or simply just revisiting one of the diffs (buffers), resets/clobbers all of my winhl customizations. Is there any reason why this plugin is dynamically changing/resetting options on TabLeave, or, when revisiting a previously-viewed buffer (especially given the fact that the window ids remain the same)? This is silly and unexpected behavior imo. How else can I customize winhl? Right now I'm using a DiffviewDiffBufRead autocmd (because setting win opts or config via this plugin seems to be only supported for "panels"?).
I guess in the meantime I need to choose a different autocmd, or force my highlights with a window namespace.
EDIT: it seems that other window options, like
spell, are not reset/clobbered. So I assume thewinhlissue is because either:A.
winhlis set by this plugin, whilespellisn't B.winhlisn't getting set/reset properly (although it probably shouldn't be reset in the first place, unless there is a good reason to do so)
Expected behavior
- Don't reset options post-load if it is not necessary.
- Don't clobber
winhlor any other list-like options that this plugin sets (you need to share, or allow me a way to accomplish this via other means, lol).
Actual behavior
See Description
Steps to reproduce
nvim --clean
DiffviewOpen {somerev}
-- Set winhl without clobbering other mappings.
-- This could even be improved further (but I won't do that here), as hl groups are in fact case-insensitive.
local w = vim.opt_local.winhl
w.DiffChange = 'MyDiffChangeAsDiffDelete'
vim.opt_local.winhl = w
-- Now just trigger issue as explained above
Health check
Likely irrelevant, but here it is:
diffview: require("diffview.health").check()
Checking plugin dependencies ~
- OK nvim-web-devicons installed.
Checking VCS tools ~
- The plugin requires at least one of the supported VCS tools to be valid.
- OK Git found.
- OK Git is up-to-date. (2.45.1)
- WARNING Configured `hg_cmd` is not executable: 'hg'
Log info
n/a
Neovim version
0.10
Operating system and version
macOS 14.2.1
Minimal config
n/a, defaults
Maybe related to: #457, #442
Idk why (it fires on TabEnter), but I guess adding DiffviewDiffBufWinEnter to the events of my autocmd helps as a workaround.
This also doesn't work:
nvim --clean +"lua require('diffview').setup { commit_log_panel = { win_config = { winopts = { winblend = 10, } } } }"