Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Snacks.terminal gracefully handle :wqa #419

Open
1 task done
tonymajestro opened this issue Jan 3, 2025 · 0 comments
Open
1 task done

feature: Snacks.terminal gracefully handle :wqa #419

tonymajestro opened this issue Jan 3, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@tonymajestro
Copy link

tonymajestro commented Jan 3, 2025

Did you check the docs?

  • I have read all the snacks.nvim docs

Is your feature request related to a problem? Please describe.

I often have several buffers open and when I want to exit neovim, I use :wqa. However this causes issues when the snacks terminal buffers are still open, resulting in the following errors:

E948: Job still running
E676: No matching autocommands for buftype= buffer

It would be nice if the terminal plugin was able to suppress errors related to writing to the terminal buffers when neovim is trying to exit.

Repro steps

Config:

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",
		"--single-branch",
		"https://github.com/folke/lazy.nvim.git",
		lazypath,
	})
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
	-- do not remove the colorscheme!
	"folke/tokyonight.nvim",
	{
		"folke/snacks.nvim",
		opts = {
			terminal = {
				enabled = true,
			},
		},
	},
}
require("lazy").setup(plugins, {
	root = root .. "/plugins",
})

vim.opt.termguicolors = true
vim.cmd([[colorscheme tokyonight]])
  • Open neovim with nvim -u repro.lua
  • Open snacks terminal with :lua snacks.terminal.toggle()
  • Hide snacks terminal with :lua snacks.terminal.toggle()
  • Try to quit neovim with :wqa

Describe the solution you'd like

It would be nice if the plugin could suppress errors related to writing to the terminal buffers when exiting neovim with :wqa

Describe alternatives you've considered

I have worked around this by first doing :wa (which does not seem to trigger any errors) followed by :q. However it would be nice to be able to quit with one command using :wqa

Additional context

No response

@tonymajestro tonymajestro added the enhancement New feature or request label Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant