neogit
neogit copied to clipboard
Unusable diff highlight on NeogitStatus with the new default light colorscheme (nvim-0.10.0-nightly)
Description
Using the default light colorscheme the diffview on the NeogitStatus view has a black or almost black bacground that makes the text in the diff context unreadable.
Neovim version
NVIM v0.10.0-dev-2465+ga7788c2e2 Build type: RelWithDebInfo LuaJIT 2.1.1707061634
Operating system and version
macOS 14.2.1 but probably doesn't matter
Steps to reproduce
- remove/comment the colorscheme setting
- set the background option to light
- open NeogitStatus
- toggle the diffview for any unstaged/staged file
Expected behavior
The diff panel has a light background too.
Actual behavior
Minimal config
-- comment or remove vim.cmd.colorscheme '???'
vim.opt.background = light
^^ Thats how it looks for me with nvim nightly with the default colorscheme. Are you doing anything else that might be confounding things?
Meanwhile I started to use a custom colorscheme and what I realised that the colorscheme plugin must be loaded before neogit otherwise the same thing happens. I think maybe because I never set the default theme explicitly and it was loaded after neogit too.
Also I found this issue that might be related.
Makes sense - we derive colors from your colorscheme in order to make it look good without requiring every colorscheme add a bunch of highlight groups, but that does mean that if neogit is loaded before your colorscheme, it might look off. I could probably add an autocmd to help with this, though.
Oh, shoot, I already added an autocmd for ColorScheme
events. Huh. It seems to work for me.
I took another look on this and still not works with the default theme until I explicitly declare vim.cmd.colorscheme 'default'
. Then I realised that it is because I load plugins eagerly. I tried to load neogit lazily with MiniDeps.later
and it works as expected with the default theme.
So at the end it is the same for me. I need to make sure that the neogit plugin is loaded and set after the colorscheme. I have no idea why the colorscheme autocmd is not working for me.
What's quite interesting here is that Neovim loads plugins before setting default colorscheme.
@suliatis thanks for finding that out. Lazy loading it like this solved my problem:
-- Lazy plugin manager
{
"NeogitOrg/neogit",
cmd = "Neogit", ------------ Only load Neogit when I absolutely need to
-- ...
},
@suliatis thanks for finding that out.
Lazy loading it like this solved my problem:
-- Lazy plugin manager { "NeogitOrg/neogit", cmd = "Neogit", ------------ Only load Neogit when I absolutely need to -- ... },
For what its worth, this is my setup too :)