1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2025-07-03 00:49:26 +00:00

[neovim] Add commands and keymaps to Neotest

This commit is contained in:
2024-02-04 17:55:49 +01:00
parent 6bd5f85550
commit b80f54b07c
3 changed files with 47 additions and 7 deletions

View File

@ -1,4 +1,5 @@
local neotest_ns = vim.api.nvim_create_namespace("neotest")
vim.diagnostic.config({
virtual_text = {
format = function(diagnostic)
@ -7,8 +8,33 @@ vim.diagnostic.config({
end,
},
}, neotest_ns)
require("neotest").setup({
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({
adapters = {
require("neotest-go"),
require("neotest-go")({
recursive_run = true,
experimental = {
test_table = true,
},
args = { "-count=1" },
}),
},
})
vim.api.nvim_create_user_command("RunTest", function()
neotest.run.run()
end, {})
vim.api.nvim_create_user_command("RunTestFile", function()
neotest.run.run(vim.fn.expand('%'))
end, {})