diff --git a/symlinks/config/nvim/after/plugin/testing.lua b/symlinks/config/nvim/after/plugin/testing.lua deleted file mode 100644 index c231ede..0000000 --- a/symlinks/config/nvim/after/plugin/testing.lua +++ /dev/null @@ -1,53 +0,0 @@ -------------------------------------------------------------------------------- --- - Vim-test and general testing config - -------------------------------------------------------------------------------- - -local neotest = require("neotest") -neotest.setup({ - adapters = { - require("rustaceanvim.neotest")({ - args = { "--no-capture" }, - }), - require("neotest-plenary"), - require("neotest-vim-test")({ - ignore_file_types = { "rust", "lua" }, - }), - }, -}) - -local last = nil - --- Map test running commands -local opts = { silent = true } -vim.keymap.set("n", "tn", function() - last = nil - neotest.run.run() -end, opts) -vim.keymap.set("n", "tdn", function() - last = { strategy = "dap", suite = false } - neotest.run.run(last) -end, opts) -vim.keymap.set("n", "tf", function() - last = vim.fn.expand("%") - neotest.run.run(last) -end, opts) -vim.keymap.set("n", "tdf", function() - last = { vim.fn.expand("%"), strategy = "dap", suite = false } - neotest.run.run(last) -end, opts) -vim.keymap.set("n", "ts", function() - last = { suite = true } - neotest.run.run(last) -end, opts) -vim.keymap.set("n", "tds", function() - last = { strategy = "dap", suite = true } - neotest.run.run(last) -end, opts) -vim.keymap.set("n", "tl", function() - if last then - neotest.run.run(last) - else - neotest.run.run() - end -end, opts) -vim.keymap.set("n", "tp", neotest.output_panel.open, opts) diff --git a/symlinks/config/nvim/lua/esensar/init/plugins.lua b/symlinks/config/nvim/lua/esensar/init/plugins.lua index ffa4056..132e9d4 100644 --- a/symlinks/config/nvim/lua/esensar/init/plugins.lua +++ b/symlinks/config/nvim/lua/esensar/init/plugins.lua @@ -45,7 +45,70 @@ return require("lazy").setup({ -- Tools "direnv/direnv.vim", -- Integration with Direnv - "nvim-neotest/neotest", -- Running tests from NeoVim + { + "nvim-neotest/neotest", -- Running tests from NeoVim + keys = { + { "tn", mode = "n" }, + { "tdn", mode = "n" }, + { "tf", mode = "n" }, + { "tdf", mode = "n" }, + { "tl", mode = "n" }, + { "ts", mode = "n" }, + { "tds", mode = "n" }, + { "tp", mode = "n" }, + }, + config = function() + local neotest = require("neotest") + neotest.setup({ + adapters = { + require("rustaceanvim.neotest")({ + args = { "--no-capture" }, + }), + require("neotest-plenary"), + require("neotest-vim-test")({ + ignore_file_types = { "rust", "lua" }, + }), + }, + }) + + local last = nil + + -- Map test running commands + local opts = { silent = true } + vim.keymap.set("n", "tn", function() + last = nil + neotest.run.run() + end, opts) + vim.keymap.set("n", "tdn", function() + last = { strategy = "dap", suite = false } + neotest.run.run(last) + end, opts) + vim.keymap.set("n", "tf", function() + last = vim.fn.expand("%") + neotest.run.run(last) + end, opts) + vim.keymap.set("n", "tdf", function() + last = { vim.fn.expand("%"), strategy = "dap", suite = false } + neotest.run.run(last) + end, opts) + vim.keymap.set("n", "ts", function() + last = { suite = true } + neotest.run.run(last) + end, opts) + vim.keymap.set("n", "tds", function() + last = { strategy = "dap", suite = true } + neotest.run.run(last) + end, opts) + vim.keymap.set("n", "tl", function() + if last then + neotest.run.run(last) + else + neotest.run.run() + end + end, opts) + vim.keymap.set("n", "tp", neotest.output_panel.open, opts) + end, + }, "nvim-neotest/nvim-nio", "nvim-neotest/neotest-plenary", "saecki/crates.nvim",