MagicDuck / grug-far.nvim

Find And Replace plugin for neovim
MIT License
832 stars 25 forks source link

toggle_instance should not fail then buffer with that instance is deleted. #163

Closed choovick closed 3 months ago

choovick commented 3 months ago

I'm trying to configure nice persistent config, mostly using named instances.

Steps to reproduce:

  1. Open any file buffer.
  2. Swan named buffer with grug-far: :lua require("grug-far").toggle_instance({ instanceName = "far", staticTitle = "Find and Replace" })
  3. Delete buffer: :bd
  4. Spawn same buffer: :lua require("grug-far").toggle_instance({ instanceName = "far", staticTitle = "Find and Replace" })

Expected behaviour: When named buffer not found, new one is created.

Actual behaviour: Error:

E5108: Error executing lua ...34/.local/share/nvim/lazy/grug-far.nvim/lua/grug-far.lua:310: Invalid window id: 1013
stack traceback:
        [C]: in function 'nvim_win_close'
        ...34/.local/share/nvim/lazy/grug-far.nvim/lua/grug-far.lua:310: in function 'toggle_instance'
        [string ":lua"]:1: in main chunk
MagicDuck commented 3 months ago

@choovick thanks for the clear bug report! Problem should be fixed now 😄 Closing the ticket for issue management purposes, but feel free to re-open if you run into any problems.

choovick commented 3 months ago

@MagicDuck thank you for a quick fix! Can confirm new empty instances are spawning post buffer deletion of grug-far!

Thank you so much for mazing plugin 🎉 final piece for me to just the ship from Intellij and VSCode.