snacks.nvim icon indicating copy to clipboard operation
snacks.nvim copied to clipboard

bug: Zoom doesn't work in terminal buffers

Open aweis89 opened this issue 11 months ago • 0 comments

Did you check docs and existing issues?

  • [x] I have read all the snacks.nvim docs
  • [x] I have updated the plugin to the latest version before submitting this issue
  • [x] I have searched the existing issues of snacks.nvim
  • [x] I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

0.11.1

Operating system/version

15.5

Describe the bug

When it a neovim terminal, if require("snacks.zen").zoom() is called, it will zoom the buffer as expected, but it will not minimize when called again.

Steps To Reproduce

  1. Set a keymap to zoom in terminal mode:
vim.keymap.set({ "t", "n", "i" }, "<C-a>i", function()
  require("snacks.zen").zoom()
end, { desc = "Zoom toggle" })
  1. Open a neovim terminal in split :vsplit | terminal

  2. Trigger the zoom via the mapping <C-a>i

  3. Trigger the same mapping again to minimize the terminal.

  4. It won't work and you should see the following error:

stack traceback:
[C]: in function 'nvim_exec2'
vim/_editor.lua: in function 'cmd'
...rg/.local/share/nvim/lazy/snacks.nvim/lua/snacks/zen.lua:148: in function 'zoom'
/Users/aaron.weisberg/.config/nvim/lua/config/keymaps.lua:39: in function </Users/aaron.weisberg/.config/nvim/lua/config/keymaps.lua:38>E510
8: Error executing lua: vim/_editor.lua:0: nvim_exec2(), line 1: Vim(normal):Can't re-enter normal mode from terminal mode

Expected Behavior

Terminal buffers should behave the same as other buffers and the zoom functionality should work for zooming and then minimizing

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    { "folke/snacks.nvim",
      opts = function()
      vim.keymap.set({ "t", "n", "i" }, "<C-a>i", function()
        require("snacks.zen").zoom()
      end, { desc = "Zoom toggle" })
    end,
   },
    -- add any other plugins here
  },
})

aweis89 avatar May 25 '25 03:05 aweis89