NeogitOrg / neogit

An interactive and powerful Git interface for Neovim, inspired by Magit
MIT License
3.86k stars 227 forks source link

Unusable diff highlight on NeogitStatus with the new default light colorscheme (nvim-0.10.0-nightly) #1192

Closed suliatis closed 4 months ago

suliatis commented 6 months ago

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.

Screenshot 2024-03-06 at 8 25 26 AM

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

  1. remove/comment the colorscheme setting
  2. set the background option to light
  3. open NeogitStatus
  4. 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
CKolkey commented 6 months ago
Screenshot 2024-03-14 at 21 25 57

^^ Thats how it looks for me with nvim nightly with the default colorscheme. Are you doing anything else that might be confounding things?

suliatis commented 6 months ago

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.

suliatis commented 6 months ago

Also I found this issue that might be related.

CKolkey commented 6 months ago

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.

CKolkey commented 6 months ago

Oh, shoot, I already added an autocmd for ColorScheme events. Huh. It seems to work for me.

suliatis commented 5 months ago

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.

gegoune commented 5 months ago

What's quite interesting here is that Neovim loads plugins before setting default colorscheme.

andradei commented 4 months ago

@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
    -- ...
  },
CKolkey commented 4 months ago

@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 :)