neo-tree.nvim icon indicating copy to clipboard operation
neo-tree.nvim copied to clipboard

BUG: highlight group of an opened file previewed first remains `NormalFloat`

Open Mayrixon opened this issue 1 year ago • 3 comments

Did you check docs and existing issues?

  • [X] I have read all the docs.
  • [X] I have searched the existing issues.
  • [X] I have searched the existing discussions.

Neovim Version (nvim -v)

0.9.1

Operating System / Version

macOS 13.4.1

Describe the Bug

I am using ellisonleao/grovbox.nvim as the colorscheme. If I open a buffer when previewing the file, the buffer highlight is wrong.

Screenshots, Traceback

preview enter-after-prevew

Steps to Reproduce

  1. Open Neotree and preview a file.
  2. Hit <Enter> when preview window remaining open.

Expected Behavior

The buffer highlight of the previewed file should be Normal after open the file.

The plugin gruvbox.nvim sets a different bg color in highlight group NormalFloat, so it's easily found the highlight group of the previewed file is NormalFloat.

Your Configuration

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
      "ellisonleao/gruvbox.nvim",
}

local neotree_config = {
  "nvim-neo-tree/neo-tree.nvim",
  dependencies = { "MunifTanjim/nui.nvim", "nvim-tree/nvim-web-devicons", "nvim-lua/plenary.nvim" },
  cmd = { "Neotree" },
  keys = {
    { "<Leader>e", "<Cmd>Neotree<CR>" }, -- change or remove this line if relevant.
  },
  opts = {
    -- Your config here
    -- ...
  },
}

table.insert(plugins, neotree_config)
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("gruvbox")

Mayrixon avatar Jul 08 '23 17:07 Mayrixon

I am experiencing the same issue with the JellyBeans colorscheme. The issue can be reproduced by substituting "ellisonleao/gruvbox.nvim", with "nanotech/jellybeans.vim" in the minimal config provided by Mayrixon.

jakubbortlik avatar Jul 10 '23 12:07 jakubbortlik

@Mayrixon I am using gruvbox colorscheme too, for me I just set

vim.cmd("hi NormalFloat guibg=#32302F")
vim.cmd("hi FloatBorder guibg=#32302F")

to achieve a consistent experience, hope it helps :)

Here is the image of neotree preview window: image

yizhenAllen avatar Aug 20 '23 00:08 yizhenAllen

In addition to highlight groups, some options are changed too, for example "relativenumber", "list", "cursorline", "colorcolumn"...

image

botbotty avatar Sep 26 '23 05:09 botbotty