neogit icon indicating copy to clipboard operation
neogit copied to clipboard

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

Open suliatis opened this issue 11 months ago • 7 comments

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

suliatis avatar Mar 06 '24 07:03 suliatis

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?

CKolkey avatar Mar 14 '24 20:03 CKolkey

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 avatar Mar 18 '24 19:03 suliatis

Also I found this issue that might be related.

suliatis avatar Mar 18 '24 19:03 suliatis

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 avatar Mar 18 '24 20:03 CKolkey

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

CKolkey avatar Mar 18 '24 20:03 CKolkey

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.

suliatis avatar Mar 24 '24 20:03 suliatis

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

gegoune avatar Mar 24 '24 21:03 gegoune

@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
    -- ...
  },

andradei avatar May 16 '24 21:05 andradei

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

CKolkey avatar May 16 '24 22:05 CKolkey