41 lines
876 B
Lua
41 lines
876 B
Lua
local M = {}
|
|
|
|
function M.setup(opts)
|
|
opts = opts or {}
|
|
local filetypes = opts.filetypes
|
|
or {
|
|
"checkhealth",
|
|
"help",
|
|
"lspinfo",
|
|
"man",
|
|
"neotest-output",
|
|
"neotest-output-panel",
|
|
"neotest-summary",
|
|
"notify",
|
|
"qf",
|
|
"query",
|
|
"startuptime",
|
|
}
|
|
local group = vim.api.nvim_create_augroup("tiny-shoo", { clear = true })
|
|
|
|
vim.api.nvim_create_autocmd("FileType", {
|
|
group = group,
|
|
pattern = filetypes,
|
|
callback = function(event)
|
|
vim.bo[event.buf].buflisted = false
|
|
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true })
|
|
end,
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd("WinEnter", {
|
|
group = group,
|
|
callback = function()
|
|
if vim.fn.winnr("$") == 1 and vim.bo.buftype == "quickfix" then
|
|
vim.cmd("quit")
|
|
end
|
|
end,
|
|
})
|
|
end
|
|
|
|
return M
|