1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2024-12-23 19:36:47 +00:00
dotfiles/.config/nvim/lua/plugins/neotest.lua

39 lines
874 B
Lua
Raw Normal View History

2024-02-03 15:22:54 +00:00
local neotest_ns = vim.api.nvim_create_namespace("neotest")
2024-02-03 15:22:54 +00:00
vim.diagnostic.config({
virtual_text = {
format = function(diagnostic)
local message = diagnostic.message:gsub("\n", " "):gsub("\t", " "):gsub("%s+", " "):gsub("^%s+", "")
return message
end,
},
}, neotest_ns)
vim.api.nvim_create_user_command("CopyDirectoryPath", function()
local path = vim.fn.expand("%:p:h")
vim.fn.setreg("+", path)
vim.notify('Copied "' .. path .. '" to the clipboard!')
end, {})
local neotest = require("neotest")
neotest.setup({
2024-02-03 15:22:54 +00:00
adapters = {
require("neotest-go")({
recursive_run = true,
experimental = {
test_table = true,
},
args = { "-count=1" },
}),
2024-02-03 15:22:54 +00:00
},
})
vim.api.nvim_create_user_command("RunTest", function()
2024-02-12 19:46:40 +00:00
neotest.run.run()
end, {})
vim.api.nvim_create_user_command("RunTestFile", function()
2024-02-12 19:46:40 +00:00
neotest.run.run(vim.fn.expand("%"))
end, {})