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: error when bring up "cmdwin" when edge bar is available #78

Closed jackielii closed 3 months ago

jackielii commented 5 months ago

Did you check docs and existing issues?

Neovim version (nvim -v)

NVIM v0.10.0-dev-2952+g97c0a5241-Homebrew

Operating system/version

MacOS 14.2.1

Describe the bug

So I have edgy.nvim pinned neo-tree files view. When I tried to bring up my command history (:h cmdwin). I get error straight away:

.../jackieli/tmp/.repro/plugins/edgy.nvim/lua/edgy/util.lua:70: ...ckieli/tmp/.repro/plugins/edgy.nvim/lua/edgy/edgebar.lua:194: Error executing lua: vim/_editor.lua:0: nvim_exec2(): Vim(wincmd):E11: Invalid in command-line window; <CR> executes, CTRL-C quits       
stack traceback:                                                                                                                                                                                                                                                          
^I[C]: in function 'nvim_exec2'                                                                                                                                                                                                                                           
^Ivim/_editor.lua: in function 'cmd'                                                                                                                                                                                                                                      
^I...ckieli/tmp/.repro/plugins/edgy.nvim/lua/edgy/edgebar.lua:195: in function <...ckieli/tmp/.repro/plugins/edgy.nvim/lua/edgy/edgebar.lua:194>                                                                                                                          
^I[C]: in function 'nvim_win_call'                                                                                                                                                                                                                                        
^I...ckieli/tmp/.repro/plugins/edgy.nvim/lua/edgy/edgebar.lua:194: in function 'layout'                                                                                                                                                                                   
^I...ackieli/tmp/.repro/plugins/edgy.nvim/lua/edgy/layout.lua:146: in function 'fn'                                                                                                                                                                                       
^I...ackieli/tmp/.repro/plugins/edgy.nvim/lua/edgy/layout.lua:103: in function 'foreach'                                                                                                                                                                                  
^I...ackieli/tmp/.repro/plugins/edgy.nvim/lua/edgy/layout.lua:145: in function 'layout'                                                                                                                                                                                   
^I...ackieli/tmp/.repro/plugins/edgy.nvim/lua/edgy/layout.lua:182: in function <...ackieli/tmp/.repro/plugins/edgy.nvim/lua/edgy/layout.lua:181>                                                                                                                          
^I[C]: in function 'pcall'                                                                                                                                                                                                                                                
^I.../jackieli/tmp/.repro/plugins/edgy.nvim/lua/edgy/util.lua:67: in function <.../jackieli/tmp/.repro/plugins/edgy.nvim/lua/edgy/util.lua:65>                                                                                                                            
^I[C]: in function 'pcall'                                                                                                                                                                                                                                                
^I.../jackieli/tmp/.repro/plugins/edgy.nvim/lua/edgy/util.lua:47: in function <.../jackieli/tmp/.repro/plugins/edgy.nvim/lua/edgy/util.lua:46>   

Steps To Reproduce

  1. launch with repro.lua: nvim -u repro.lua
  2. open neotree: :Neotree
  3. open cmdline-window using : followed by <C-f>
  4. error shows

Expected Behavior

no error appears

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",
  {
    "nvim-neo-tree/neo-tree.nvim",
    dependencies = {
      "nvim-lua/plenary.nvim",
      "MunifTanjim/nui.nvim",
    },
  },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
require("neo-tree").setup({})
require("edgy").setup({
  left = {
    {
      title = "Neo-Tree",
      ft = "neo-tree",
      filter = function(buf)
        return vim.b[buf].neo_tree_source == "filesystem"
      end,
      pinned = true,
      open = function()
        vim.api.nvim_input("<esc><space>f")
      end,
      size = { height = 0.5 },
    },
  },
})