diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index 5b0b394d..9f67206d 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -52,6 +52,7 @@ vim.api.nvim_create_autocmd("FileType", { "startuptime", "tsplayground", "checkhealth", + "neotest-output", }, callback = function(event) vim.bo[event.buf].buflisted = false diff --git a/lua/lazyvim/plugins/extras/test/core.lua b/lua/lazyvim/plugins/extras/test/core.lua index f7605fe5..8f5843ec 100644 --- a/lua/lazyvim/plugins/extras/test/core.lua +++ b/lua/lazyvim/plugins/extras/test/core.lua @@ -1,39 +1,26 @@ return { { - "nvim-neotest/neotest", - dependencies = { - -- which key integration - { - "folke/which-key.nvim", - opts = { - defaults = { - ["t"] = { name = "+test" }, - }, - }, + "folke/which-key.nvim", + optional = true, + opts = { + defaults = { + ["t"] = { name = "+test" }, }, }, + }, + { + "nvim-neotest/neotest", config = function(_, opts) - -- get neotest namespace (api call creates or returns namespace) local neotest_ns = vim.api.nvim_create_namespace("neotest") vim.diagnostic.config({ virtual_text = { format = function(diagnostic) + -- Replace newline and tab characters with space for more compact diagnostics local message = diagnostic.message:gsub("\n", " "):gsub("\t", " "):gsub("%s+", " "):gsub("^%s+", "") return message end, }, }, neotest_ns) - local group = vim.api.nvim_create_augroup("lazyvim_neotest_close_with_q", { clear = true }) - vim.api.nvim_create_autocmd("FileType", { - group = group, - pattern = { - "neotest-output", - }, - callback = function(event) - vim.bo[event.buf].buflisted = false - vim.keymap.set("n", "q", "close", { buffer = event.buf, silent = true }) - end, - }) require("neotest").setup(opts) end,