Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background color #245

Closed
ziulev opened this issue Mar 23, 2021 · 13 comments
Closed

Background color #245

ziulev opened this issue Mar 23, 2021 · 13 comments

Comments

@ziulev
Copy link

ziulev commented Mar 23, 2021

Is it possible to set a custom background color only for the tree?

@kyazdani42
Copy link
Member

hum used to be the case but i did not manage to do it. I'm pushing a fix to set back the winhighlight (don't know why it wasn't set anymore).
I'm going to investigate because i cannot manage to override the link from the plugin in my configs ...

@kyazdani42
Copy link
Member

well i have no clue why, but i cannot manage to set NvimTreeNormal in my configs (but i can in the plugin source), the group is always cleared no matter where i put i in my config. I'll come back here if i can understand why this happens ...

@hrqmonteiro
Copy link

hrqmonteiro commented Apr 1, 2021

I was wondering that as well. NvimTreNormal makes no difference whatsoever.

I was able to change it setting this autocmd, in case it helps you:

autocmd ColorScheme * highlight highlight NvimTreeBg guibg=#2B4252
autocmd FileType NvimTree setlocal winhighlight=Normal:NvimTreeBg

2021-03-31_22-11

@kyazdani42
Copy link
Member

this was fixed in the view refactoring, you can now set NvimTreeNormal and it works fine :)

@akinsho
Copy link
Contributor

akinsho commented Apr 17, 2021

@kyazdani42 I just tried this out, I'd been using a similar winhighlight override for a while anyway. From looking at the current implementation though it seems to set winhighlight like

EndOfBuffer:NvimTreeEndOfBuffer,Normal:NvimTreeNormal,CursorLine:NvimTreeCursorLine,VertSplit:NvimTreeVertSplit,SignColumn:Normal

This means that for me anyway I see that signcolumn is highlighted the same as the normal buffer but not the same as the rest of the tree. I think SignColumn:Normal should be SignColumn:NvimTreeNormal.

@kyazdani42
Copy link
Member

indeed, just fixed that in latest master

@yamatsum
Copy link
Contributor

When I open a new tab from nvim-tree after setting as below, the background color of the new tab is strange(same as NvimTreeNormal)
vim.cmd("autocmd Colorscheme * highlight NvimTreeNormal guibg=#21252B guifg=#9da5b3")

@kyazdani42
Copy link
Member

@yamatsum this is another issue that i don't know how to tackle but bothers me too, you can follow that in #290

@kirill-martynov
Copy link

kirill-martynov commented Dec 15, 2023

When I open a new tab from nvim-tree after setting as below, the background color of the new tab is strange(same as NvimTreeNormal) vim.cmd("autocmd Colorscheme * highlight NvimTreeNormal guibg=#21252B guifg=#9da5b3")

@kyazdani42 Same issue happening with me, I'am using default settings for nvim-tree

  -- nvim-tree
  {
    "nvim-tree/nvim-tree.lua",
    dependencies = {
      "nvim-tree/nvim-web-devicons",
    },
    config = function()
      -- disable netrw at the very start of your init.lua
      vim.g.loaded_netrw = 1
      vim.g.loaded_netrwPlugin = 1

      require("nvim-tree").setup({
        view = { side = "right", width = 50 },
        update_focused_file = { enable = true, update_cwd = false },

        renderer = {
          highlight_modified = "all",
          highlight_git = true,

          root_folder_label = false,

          icons = { webdev_colors = false, show = { folder_arrow = false } },
          indent_markers = { enable = true },
        },
      })
    end,
  },
Screen.Recording.2023-12-15.at.14.47.47.mov

I don't know to fix it, it happens randomly, but i think mostly after I'm trying to open in a new tab from nvim-tree

@alex-courtis
Copy link
Member

Have you got any other plugins or automation that may alter NvimTreeNormal ? It might be a race condition.

Are you setting NvimTreeNormalNC to match? That might explain the window switching behaviour.

Can you :hi NvimTreeNormalNC and :hi NvimTreeNormal to see what's happened when this behaviour occurs?

@subhranildas
Copy link

Here is a long and late reply .. just keep these two lines if you are using tokyonight .. and you will be set .. every thing will stay transparent.

vim.cmd("autocmd VimEnter * hi NvimTreeNormal guibg=NONE" )
vim.cmd("autocmd VimEnter * hi NvimTreeNormalNC guibg=NONE" )

Cheers !!!

@maleksware
Copy link

The issue @kirill-martynov is facing seems to be replicatable with the following: open Nvim, toggle the tree, open the file in split view (C-v by default). It will open to the right of the default Nvim empty buffer. Then open another file from the tree with CR. Close both windows with wq and then open any file from the tree - it will have a different colorscheme. Tested on Neovim, nvim-tree and catppuccin.nvim from master as of the day of writing.

I could not replicate the colorscheme change if I closed the window with the empty buffer first. This is probably connected to the cause of the issue.

No idea why this might be happening.

@alex-courtis
Copy link
Member

Unfortunately I can't replicate this one; I'm not quite sure what/where/how fast the flicker is.

@maleksware can you please raise a new Bug Report with a minimal reproducer that we can also share with lualine.

In the meantime I'm watching

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants