folke / edgy.nvim

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

bug: Neo-tree in Edgy broken with Neovim nightly~480 #45

Closed distek closed 1 year ago

distek commented 1 year ago

Did you check docs and existing issues?

Neovim version (nvim -v)

NVIM v0.10.0-dev-473+gb3d5138f

Operating system/version

Both Linux and Macos - OS independent

Describe the bug

Starting from neovim/neovim@b3d5138fd, neo-tree in edgy doesn't work quite right.

Prior to this, opening the left sidebar in my config looked like this: image

After the mentioned commit: image

Going to investigate further. Wanted to get this noted, though.

Edit: Forgot to note: When using the problem commit, nothing happens after I toggle("left") until I press any additional key.

Steps To Reproduce

  1. use neovim/neovim@b3d5138fd
  2. Use this config for edgy:

    {
        "folke/edgy.nvim",
        event = "VeryLazy",
        opts = {
            options = {
                left = { size = 35 },
                top = { size = 15 },
                bottom = { size = 15 },
                right = { size = 35 },
            },
            exit_when_last = true,
            wo = {
                -- Setting to `true`, will add an edgy winbar.
                -- Setting to `false`, won't set any winbar.
                -- Setting to a string, will set the winbar to that string.
                winbar = false,
                winfixwidth = true,
                winfixheight = true,
                winhighlight = "WinBar:EdgyWinBar",
                spell = false,
                signcolumn = "no",
                statuscolumn = "",
                number = false,
                relativenumber = false,
            },
            keys = {
                ["q"] = function(win)
                    win:hide()
                end,
                ["<c-q>"] = false,
                ["Q"] = false,
                ["]w"] = false,
                ["[w"] = false,
                ["]W"] = false,
                ["[W"] = false,
                ["<c-w>>"] = false,
                ["<c-w><lt>"] = false,
                ["<c-w>+"] = false,
                ["<c-w>-"] = false,
                ["<c-w>"] = false,
                ["<A-C-j>"] = function(win)
                    win:resize("height", 1)
                end,
                ["<A-C-k>"] = function(win)
                    win:resize("height", -2)
                end,
                ["<A-C-h>"] = function(win)
                    win:resize("width", 2)
                end,
                -- decrease width
                ["<A-C-l>"] = function(win)
                    win:resize("width", -2)
                end,
            },
            animate = {
                enabled = false,
            },
            top = {
                {
                    ft = "qf",
                    title = "QuickFix",
                    pinned = true,
                    open = ":copen",
                    wo = {
                        winbar = true,
                        winhighlight = "Normal:EdgyQuickfixNormal",
                    },
                },
            },
            bottom = {
                {
                    ft = "toggleterm",
                    size = { height = 0.15 },
                    pinned = true,
                    open = function()
                        local t = require("tt")
    
                        if #t.terminal.TermList == 0 then
                            t.terminal:NewTerminal()
                            return
                        end
    
                        if t:IsOpen() then
                            t.terminal:Close()
                            return
                        end
    
                        t.terminal:Open("last")
                    end,
                    -- wo = {
                    --  winhighlight = "Normal:EdgyTermNormal",
                    -- },
                },
                {
                    ft = "termlist",
                    size = { height = 0.15, width = 25 },
                },
                "Trouble",
            },
            left = {
                {
                    title = "Buffers",
                    ft = "neo-tree",
                    size = { height = 0.15 },
                    filter = function(buf)
                        return vim.b[buf].neo_tree_source == "buffers"
                    end,
                    pinned = true,
                    visible = true,
                    wo = {
                        height = "15",
                        winbar = true,
                    },
                    open = "Neotree source=buffers position=left",
                },
                {
                    title = "File Tree",
                    ft = "neo-tree",
                    size = { height = 0.85 },
                    pinned = true,
                    visible = true,
                    filter = function(buf)
                        return vim.b[buf].neo_tree_source == "filesystem"
                    end,
                    wo = {
                        winbar = true,
                    },
                    open = "Neotree filesystem position=top",
                },
            },
            right = {
                {
                    ft = "Outline",
                    visible = false,
                    size = { height = 0.25 },
                    pinned = true,
                    open = "SymbolsOutlineOpen",
                    wo = {
                        winbar = true,
                    },
                },
                {
                    ft = "help",
                    size = { width = 79 },
                    filter = function(buf)
                        return vim.bo[buf].buftype == "help"
                    end,
                    wo = {
                        winhighlight = "Normal:EdgyHelpNormal",
                    },
                },
            },
        },
    },
  3. require("edgy").toggle("left")
  4. be sad

Expected Behavior

Neo-tree in Edgy to only split on the left

Repro

No response

distek commented 1 year ago

I'm assuming it has something to do with setting window local options based on what changes were made in that commit?


Edit:

            left = {
                {
                    title = "Neo-Tree Buffers",
                    ft = "neo-tree",
                    size = { height = 0.15 },
                    filter = function(buf)
                        return vim.b[buf].neo_tree_source == "buffers"
                    end,
                    pinned = true,
                    open = "Neotree position=top buffers",
                    wo = {
                        winbar = true,
                    },
                },
                {
                    title = "Neo-Tree",
                    ft = "neo-tree",
                    filter = function(buf)
                        return vim.b[buf].neo_tree_source == "filesystem"
                    end,
                    open = "Neotree",
                    pinned = true,
                    size = { height = 0.85 },
                    wo = {
                        winbar = true,
                    },
                },
            },

~This for some reason works but my other config didn't...?~

Setting the height window option caused it to fail in that weird way where it would freeze nvim on exit. Calling it good. Leaving this open so you can see it when you get back. If you have nothing to add/have no other questions, feel free to close!

Thanks for making this! It's my favorite plugin.

folke commented 1 year ago

neo-tree still works perfectly fine for me in LazyVim.

There were some big issues upstream that were fixed in the meantime. Maybe check if that fixes this for you?

distek commented 1 year ago

I'm actually using it just fine after removing the "height" window option so I think we're good! Thanks!