nyngwang / NeoZoom.lua

A simple usecase of floating window to help you focus.
MIT License
184 stars 15 forks source link

[Bug report] Doesn't work on nvim-spectre #30

Closed kohane27 closed 2 years ago

kohane27 commented 2 years ago

Hello @nyngwang . Hope you're doing well. Thank you for creating such a handy and awesome plugin.

This plugin works perfectly on normal buffers. However, I'm trying to zoom in on the pane created by nvim-pack/nvim-spectre and it doesn't work:

screenshot-2022-06-17-15-55-19

The left side is created by the cmd :Spectre.

To reproduce:

  1. open a normal file buffer
  2. :Spectre to start find and replace by Spectre
  3. On the Spectre pane, trigger zoom-in (<C-w>m)
  4. Nothing

Does it mean that NeoZoom only works on "normal file buffers"? I'm not asking to have NeoZoom support specfically for Spectre; just trying to understand if it's a bug or a limitation of NeoZoom. dhruvasagar/vim-zoom works on Spectre pane but it creates extra buffers when closing.

Config:

NeoZoom.lua:

neo_zoom.setup({
  left_ratio = 0.0,
  top_ratio = 0.0,
  width_ratio = 1.0,
  height_ratio = 1.0,
  border = "double",
})

local noref_noerr_trunc = { noremap = true, silent = true, nowait = true }
vim.keymap.set("n", "<C-w>m", function()
  vim.cmd("NeoZoomToggle")
end, noref_noerr_trunc)

OS: Linux NVIM v0.7.0 Build type: Release LuaJIT 2.1.0-beta3

Any input is much appreciated. Thank you:)

nyngwang commented 2 years ago

[..] I'm trying to zoom in on the pane created by nvim-pack/nvim-spectre and it doesn't work.

I have made some updates so your keymap should work. But to have better UX there need so more updates. You will need to update your setup {}:

require('neo-zoom').setup {
  -- other config options
  -- ...
  -- add the following
  exclude_filetype = { 
    'spectre-panel'
  }
}

Does it mean that NeoZoom only works on "normal file buffers"? [...]

NeoZoom was designed to have no effect on any nofile buffer, which might be created by plugin like windwp/nvim-spectre in your case. This can be changed so no worries.

Thanks for the report, this is a good issue that will improve the compatibility of this plugin a lot when resolved.

nyngwang commented 2 years ago

Let me know if these updates work.

kohane27 commented 2 years ago

Hello @nyngwang . Hope you're doing well.

It works perfectly:

https://user-images.githubusercontent.com/57322459/174512604-019fd81a-d19b-46a6-b9d5-830d6d38e20c.mp4

Thank you for such a quick update. I really appreciate it:)