folke / edgy.nvim

Easily create and manage predefined window layouts, bringing a new edge to your workflow
Apache License 2.0
783 stars 14 forks source link

bug: incoherent behaviour when filetype is empty #84

Closed LoricAndre closed 2 weeks ago

LoricAndre commented 1 month ago

Did you check docs and existing issues?

Neovim version (nvim -v)

v0.11.0-dev-164+g3a1515bfe

Operating system/version

Linux loric 6.9.3-zen1-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Fri, 31 May 2024 15:14:26 +0000 x86_64 GNU/Linux

Describe the bug

When edgy is configured with a filter but an empty filetype, the window title gets set but the window itself is not controlled by edgy. I noticed this running Overseer.nvim.

image

As you can see in the screenshot, the 'Overseer runner' window does not follow edgy config (contrary to the other 2), and is not toggled with edgy.

Steps To Reproduce

  1. Install overseer.nvim
  2. Add { ft = "", filter = function(buf, win) return vim.b.overseer_task ~= nil end, title = "Overseer Runner" } to the edgy bottom section
  3. Run :OverseerToggle

Expected Behavior

The window title should be set and the window should be managed by edgy.

Repro

-- 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 = {
  "folke/tokyonight.nvim",
  "folke/edgy.nvim",
  'stevearc/overseer.nvim',
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
require('overseer').setup()
require('edgy').setup({    bottom = {
      {
        ft = "toggleterm",
        open = "ToggleTerm",
        size = {
          height = 0.3,
        },
        filter = function(_, win)
          return vim.api.nvim_win_get_config(win).relative == ""
        end,
        pinned = true,
      },
      "Trouble",
      { ft = "qf", title = "QuickFix" },
      { ft = "OverseerList", title = "Overseer List" },
      { title = "Overseer Runner", ft = "", filter = function (buf, win)
        return vim.b.overseer_task ~= nil
      end,
        size = {
          height = 0.3,
        },
      }
    },
})
folke commented 2 weeks ago

yes, edgy needs a filetype to work