From aaac1f04614943dfaf90a23024d1b9b18ced9a6c Mon Sep 17 00:00:00 2001 From: Ariel D'Alessandro Date: Tue, 19 Jul 2022 23:09:41 +0200 Subject: Add more hydras --- after/plugin/hydra.lua | 1 + after/plugin/neotest.lua | 57 +++++++++++++++++++++++++++++++++--------------- after/plugin/trouble.lua | 2 +- 3 files changed, 41 insertions(+), 19 deletions(-) (limited to 'after/plugin') diff --git a/after/plugin/hydra.lua b/after/plugin/hydra.lua index 0255a4e..e190916 100644 --- a/after/plugin/hydra.lua +++ b/after/plugin/hydra.lua @@ -13,6 +13,7 @@ hydra({ { 'h', 'h' }, { 'j', 'j' }, { 'k', 'k' }, + { 'q', 'q' }, { 'L', '2>' }, { 'H', '2<' }, { 'J', '2-' }, diff --git a/after/plugin/neotest.lua b/after/plugin/neotest.lua index efbd159..4a7175c 100644 --- a/after/plugin/neotest.lua +++ b/after/plugin/neotest.lua @@ -1,27 +1,48 @@ local ok, neotest = pcall(require, "neotest") if not ok then - return + return end neotest.setup({ - adapters = { - require("neotest-go"), - require("neotest-vim-test")({ - ignore_file_types = { "go" }, - }), - }, + adapters = { + require("neotest-go"), + require("neotest-plenary"), + require("neotest-vim-test")({ + ignore_file_types = { "go", "lua" }, + }), + }, }) --- Not working for behat --- So add the leader, not ideal but for now is the best -vim.keymap.set("n", "t", function() - neotest.run.run() -end, { silent = true, noremap = true }) +local hydra = require("hydra") -vim.keymap.set("n", "t", function() - neotest.run.run(vim.fn.expand("%")) -end, { silent = true, noremap = true }) +local hint = [[ + NeoTest + _n_: Near test _f_: Current file _s_: Toggle Summary ^ + ^ ^ __ +]] -vim.keymap.set("n", "t", function() - neotest.summary.toggle() -end, { silent = true, noremap = true }) +hydra({ + name = "neotest", + hint = hint, + mode = "n", + config = { + color = "teal", + invoke_on_body = true, + hint = { + border = "rounded", + position = "bottom", + } + }, + body = "", + heads = { + { "n", neotest.run.run }, + { + "f", + function() + neotest.run.run(vim.fn.expand("%")) + end, + }, + { "s", neotest.summary.toggle }, + { '', nil, { exit = true } } + }, +}) diff --git a/after/plugin/trouble.lua b/after/plugin/trouble.lua index 2fbb23d..a2730a7 100644 --- a/after/plugin/trouble.lua +++ b/after/plugin/trouble.lua @@ -6,4 +6,4 @@ end trouble.setup {} -vim.keymap.set('n', 'tt', ':TroubleToggle') +--vim.keymap.set('n', 'tt', ':TroubleToggle') -- cgit v1.2.3