j-morano / buffer_manager.nvim

A simple plugin to easily manage Neovim buffers.
MIT License
232 stars 12 forks source link

fix(highlight): do not override popup background with `Normal` #16

Closed utilyre closed 1 year ago

utilyre commented 1 year ago

Plenary, by default, uses NormalFloat highlight group for the popup window, which is widely used by other plugins for floating windows.

This helps colorschemes to distinguish between "the base" background and the floating window background.

So there's no need to override it with Normal.

j-morano commented 1 year ago

Thanks for the feedback! I think that you are right, it is not adequate to always override NormalFloat with Normal. However, what about adding the highlight group as an option, so that we keep the default look?

  local win_config = {
    title = "Buffers",
    line = math.floor(((vim.o.lines - height) / 2) - 1),
    col = math.floor((vim.o.columns - width) / 2),
    minwidth = width,
    minheight = height,
    borderchars = borderchars,
  }
  if config.highlight ~= "" then
    win_config["highlight"] = config.highlight
  end
  local Buffer_manager_win_id, win = popup.create(bufnr, win_config)

  if config.highlight ~= "" then
    vim.api.nvim_win_set_option(
      win.border.win_id,
      "winhl",
      config.highlight .. ":" .. config.highlight
    )
  end

In this way, if you do not want to override the highlight group with Normal, you just have to set the config option highlight to empty string. That is:

require("buffer_manager").setup({
  highlight = "",
})

Is this looking good to you?

j-morano commented 1 year ago

Hi, I added a commit with the solution that I described in my previous message. I hope it meets your needs. Otherwise, feel free to open an issue or create a PR. Thanks for the feedback!