mirror of
https://github.com/dcarrillo/dotfiles.git
synced 2024-12-22 11:38:00 +00:00
[neovim] Add commands and keymaps to Neotest
This commit is contained in:
parent
6bd5f85550
commit
b80f54b07c
@ -27,7 +27,7 @@
|
||||
"lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" },
|
||||
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "2b3d247fce06f53934174f5dfe0362c42d65c00c" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "0954d7730e749d606ddf8d7ae8846848be435d53" },
|
||||
"mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
|
||||
"mini.align": { "branch": "main", "commit": "c5ab28809c630b65ffe069b564ce1d473bbcb332" },
|
||||
"mini.starter": { "branch": "main", "commit": "0ee58ac8975a929e90c8b104987fabfd13015e25" },
|
||||
@ -44,7 +44,7 @@
|
||||
"nvim-dap": { "branch": "master", "commit": "9d81c11fd185a131f81841e64941859305f6c42d" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "0b4816e5ad5f3219e8e3ec9cce07f61b770c1974" },
|
||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "d4542ac257d3c7ee4131350db6179ae6340ce40b" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "9a6279953c82d01b58825a46ede032ab246a5983" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "d12140c5687a1186b95b3f42dbc6cc769df0cf0d" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "4fbf150a1621d52f17b099506e1a32f107079210" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "7ab799a9792f7cf3883cf28c6a00ad431f3d382a" },
|
||||
"nvim-ufo": { "branch": "main", "commit": "b0741a647efd98d9abb6cb653e056d24a07e4581" },
|
||||
@ -59,7 +59,7 @@
|
||||
"trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" },
|
||||
"typescript-tools.nvim": { "branch": "master", "commit": "c43d9580c3ff5999a1eabca849f807ab33787ea7" },
|
||||
"vim-bbye": { "branch": "master", "commit": "25ef93ac5a87526111f43e5110675032dbcacf56" },
|
||||
"vim-illuminate": { "branch": "master", "commit": "97c1265ff0b67064b6cfdc15bafc50202a537ae2" },
|
||||
"vim-illuminate": { "branch": "master", "commit": "305bf07b919ac526deb5193280379e2f8b599926" },
|
||||
"vim-kitty-navigator": { "branch": "master", "commit": "20abf8613aa228a5def1ae02cd9da0f2d210352a" },
|
||||
"vim-markdown-toc": { "branch": "master", "commit": "0e2c7cdc3ac1d067eb309a10220d001bb7be39cd" },
|
||||
"vim-visual-multi": { "branch": "master", "commit": "1c9207b28c8898ab01b54e6d6b61b0b820a814bc" },
|
||||
|
@ -138,11 +138,25 @@ keymap(
|
||||
vim.tbl_extend("force", opts, { desc = "Format the current buffer or selection" })
|
||||
)
|
||||
|
||||
-- Neotest
|
||||
keymap(
|
||||
"n",
|
||||
"<leader>tr",
|
||||
"<cmd>RunTest<cr>",
|
||||
vim.tbl_extend("force", opts, { desc = "Run test on the current function" })
|
||||
)
|
||||
keymap(
|
||||
"n",
|
||||
"<leader>tf",
|
||||
"<cmd>RunTestFile<cr>",
|
||||
vim.tbl_extend("force", opts, { desc = "Run tests on the current file" })
|
||||
)
|
||||
|
||||
-- Better paste
|
||||
keymap("v", "p", "P", vim.tbl_extend("force", opts, { desc = "Paste" }))
|
||||
|
||||
-- Press jk fast to enter
|
||||
keymap("i", "jk", "<ESC>", vim.tbl_extend("force", opts, { desc = "Enter in insert mode" }))
|
||||
-- Press jk fast to exit insert mode
|
||||
keymap("i", "jk", "<ESC>", vim.tbl_extend("force", opts, { desc = "Exit insert mode" }))
|
||||
|
||||
-- Stay in indent mode
|
||||
keymap("v", "<", "<gv", opts)
|
||||
|
@ -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, {})
|
||||
|
Loading…
Reference in New Issue
Block a user