mikesmithgh / kitty-scrollback.nvim

😽 Open your Kitty scrollback buffer with Neovim. Ameowzing!
Apache License 2.0
438 stars 11 forks source link

bug: autocmd on TermClose breaks kitty-scrollback.nvim #265

Closed atimofeev closed 1 month ago

atimofeev commented 1 month ago

How to reproduce the issue

        vim.api.nvim_create_autocmd("TermClose", {
          desc = 'Close terminal if its process has ended',
          callback = function()
             vim.cmd("bdelete")
          end
        })

Additional info

I'm not really sure if usage of such autocmd is a good practice, but I would like to report this nonetheless.

mikesmithgh commented 1 month ago

Hi @atimofeev thank you for reporting.

kitty-scrollback.nvim uses Neovim's builtin terminal under the hood. So, the autocommand is deleting the scrollback buffer once it completes. If you want to keep that autocommand, you can just disable it for kitty-scrollback.nvim like so:

if vim.env.KITTY_SCROLLBACK_NVIM ~= 'true' then
  vim.api.nvim_create_autocmd('TermClose', {
    desc = 'Close terminal if its process has ended',
    callback = function()
      vim.cmd('bdelete')
    end,
  })
end
atimofeev commented 1 month ago

Thank you! The issue was resolved for me. Feel free to close this, if no further work is planned here.

mikesmithgh commented 1 month ago

awesome :+1: