Open raynay-r opened 1 year ago
I'm not clear on what the problem is here. Can you provide more explanation as to what the problem is vs your expectation?
If it is just a matter of you not liking the default styling, you can change that by setting the appropriate highlight groups to your liking.
Sorry for being unclear. I did try to set the highlight groups but didn't get it to work. Here is a more detailed example:
vim.g.dracula_colorterm = 0
vim.cmd [[colorscheme dracula]]
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.api.nvim_set_hl(0, 'NeoTreeFloatBorder', { ctermfg=253 })
vim.api.nvim_set_hl(0, 'NeoTreeFloatNormal', { ctermfg=253 })
require "neo-tree".setup {
close_if_last_window = true,
popup_border_style = "rounded",
filesystem = {
hijack_netrw_behavior = "open_default",
group_empty_dirs = true
},
window = {
position = "float",
},
}
vim.keymap.set('n', '<leader>tc', '<cmd>Neotree position=current<cr>', { noremap = true, silent = true })
vim.keymap.set('n', '<leader>tt', '<cmd>Neotree toggle<cr>', { noremap = true, silent = true })
vim.keymap.set('n', '<leader>tf', '<cmd>Neotree focus<cr>', { noremap = true, silent = true })
local Popup = require("nui.popup")
local popup = Popup({
position = "50%",
size = {
width = 80,
height = 40,
},
enter = true,
focusable = true,
zindex = 50,
relative = "editor",
border = {
padding = {
top = 2,
bottom = 2,
left = 3,
right = 3,
},
style = "rounded",
highlight = "Normal:NeoTreeFloatNormal,FloatBorder:NeoTreeFloatBorder",
text = {
top = " I am top title ",
top_align = "center",
bottom = "I am bottom title",
bottom_align = "left",
},
},
buf_options = {
modifiable = true,
readonly = false,
},
win_options = {
winblend = 10,
winhighlight = "Normal:NeoTreeFloatNormal,FloatBorder:NeoTreeFloatBorder",
},
})
popup:mount()
It sets up NeoTree and also opens Nui Popup with a similar configuration. The only difference is that in the Popup configuration "border.highlight" includes the "Normal" group. This has the following result:
The inner window is the one I drew myself with NUI. It has the styling I want. The Neo-Tree window arround it still has the wrong border background. That's why I thought the "Normal" highlight group is missing in the "border.highlight" configuration of the Popup.
Interesting. It must be based on how the background is inheriting in the way your highlight groups are setup. I notice there is no background specified for your Normal which is unusual. Normally the Normal
highlight group is the one that determines the default background.
I don't see any harm in the change you are proposing, but before you submit a PR, you might want to confirm your Normal
highlight group is configured correctly. That is where the background color is coming from in this case since nothing else has a background specified.
I'm not sure if my issue is related to this problem, but I have this bordered background that I would like to get rid of. Which option is responsible for making it transparent (the background border)?
UPDATE:
I was able to remove border's background color by using this command
-- init.lua
vim.api.nvim_set_hl(0, "NormalFloat", {bg="#3B4252"})
P.S. I accidentally found the solution here
From a bit of testing, I've found the main problem here is that the NeoTreeFloatNormal
highlight group has no effect.
When the file explorer is rendered, there is no check as to whether it is rendering in a split or a float and the NeoTreeNormal
highlight group is applied blindly.
For example, If I specify the following highlights:
NeoTreeFloatBorder = { fg = colours.bgAlt, bg = colours.bgAlt },
NeoTreeFloatNormal = { fg = colours.fg, bg = colours.bgAlt },
NeoTreeFloatTitle = { fg = colours.cyan, bg = colours.bgAlt },
My float looks like this:
However, if I include NeoTreeNormal = { fg = colours.fg, bg = colours.bgAlt },
, it looks how I would expect:
This is not a good solution since there's no way to have separate highlights for floats and splits. As a result, the split looks a bit odd:
Hopefully, this helps narrow down the problem!
The NormalFloat
group determines the default foreground and background colors in a floating window instead of Normal
.
@raynay-r have you figured this out? I'm having the same issue with every float window
Did you check docs and existing issues?
Neovim Version (nvim -v)
0.9.1
Operating System / Version
NixOS
Describe the Bug
I have a border background around the floating neo-tree window (see screenshot). The issue seems to be here: https://github.com/nvim-neo-tree/neo-tree.nvim/blob/7e2a3caf999e2028abb643eb0472f351b2777591/lua/neo-tree/ui/popups.lua#L35
I was able to recreate the problem with a pure nui.nvim float and was able to fix it by setting the border highlight to the same value as for the window here: https://github.com/nvim-neo-tree/neo-tree.nvim/blob/7e2a3caf999e2028abb643eb0472f351b2777591/lua/neo-tree/ui/popups.lua#L38
I would be able to provide a PR if you argee that that's the issue.
Screenshots, Traceback
Steps to Reproduce
Expected Behavior
It should be possible to deactivate the border background.
Your Configuration