diff options
| author | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2022-07-19 23:09:41 +0200 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2022-07-19 23:09:41 +0200 |
| commit | aaac1f04614943dfaf90a23024d1b9b18ced9a6c (patch) | |
| tree | 9a2444f1c6e7edd4ff5f911fdeca2dfd42bac73a | |
| parent | 4f2e69e86d5d374d5167be4e52bbb672c3713219 (diff) | |
| download | nvim-conf-aaac1f04614943dfaf90a23024d1b9b18ced9a6c.tar.gz nvim-conf-aaac1f04614943dfaf90a23024d1b9b18ced9a6c.zip | |
Add more hydras
| -rw-r--r-- | after/plugin/hydra.lua | 1 | ||||
| -rw-r--r-- | after/plugin/neotest.lua | 57 | ||||
| -rw-r--r-- | after/plugin/trouble.lua | 2 | ||||
| -rw-r--r-- | lua/alpha/dap.lua | 87 | ||||
| -rw-r--r-- | lua/alpha/plugins.lua | 1 | ||||
| -rw-r--r-- | plugin/keymaps.vim | 2 | ||||
| -rw-r--r-- | plugin/packer_compiled.lua | 13 | ||||
| -rw-r--r-- | plugin/test.lua | 40 | ||||
| -rw-r--r-- | plugin/test.vim | 9 |
9 files changed, 141 insertions, 71 deletions
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', '<C-w>h' }, { 'j', '<C-w>j' }, { 'k', '<C-w>k' }, + { 'q', '<C-w>q' }, { 'L', '<C-w>2>' }, { 'H', '<C-w>2<' }, { 'J', '<C-w>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", "<leader>t<C-n>", function() - neotest.run.run() -end, { silent = true, noremap = true }) +local hydra = require("hydra") -vim.keymap.set("n", "<leader>t<C-f>", function() - neotest.run.run(vim.fn.expand("%")) -end, { silent = true, noremap = true }) +local hint = [[ + NeoTest + _n_: Near test _f_: Current file _s_: Toggle Summary ^ + ^ ^ _<Esc>_ +]] -vim.keymap.set("n", "<leader>t<C-s>", 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 = "<C-t>", + heads = { + { "n", neotest.run.run }, + { + "f", + function() + neotest.run.run(vim.fn.expand("%")) + end, + }, + { "s", neotest.summary.toggle }, + { '<Esc>', 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', '<leader>tt', ':TroubleToggle<cr>') +--vim.keymap.set('n', '<leader>tt', ':TroubleToggle<cr>') diff --git a/lua/alpha/dap.lua b/lua/alpha/dap.lua index 326ab60..6215f95 100644 --- a/lua/alpha/dap.lua +++ b/lua/alpha/dap.lua @@ -53,43 +53,54 @@ dap.listeners.after.event_initialized["dapui_config"] = function() dapui.open({}) end --- command to start debugging --- run dap continue and enable the keybindings --- when finish delete all keybindings - --- TODO create a hydra for debug - -local bindings = { - { mode = "n", lhs = "<leader>dd", rhs = dap.continue }, - { mode = "n", lhs = "<leader>dbp", rhs = dap.toggle_breakpoint }, - { mode = "n", lhs = "<leader>dl", rhs = dap.step_into }, - { mode = "n", lhs = "<leader>dj", rhs = dap.step_over }, - { mode = "n", lhs = "<leader>dk", rhs = dap.step_out }, - { mode = "n", lhs = "<leader>dc", rhs = dap.run_to_cursor }, - { mode = "v", lhs = "<leader>dv", rhs = dapui.eval }, - { mode = "n", lhs = "<leader>dcb", rhs = function () - vim.ui.input({prompt = "Condition: "}, function (condition) - dap.toggle_breakpoint(condition) - end) - end }, -} - -vim.keymap.set("n", "<leader>dst", function() - dap.continue() - for _, bind in pairs(bindings) do - vim.keymap.set(bind.mode, bind.lhs, bind.rhs, { noremap = true }) - end -end, { noremap = true }) - -vim.keymap.set("n", "<leader>dsp", function() - dap.terminate() - dapui.close({}) - dap.clear_breakpoints() +local hydra = require("hydra") +local hint = [[ + Nvim DAP + _d_: Start/Continue _j_: StepOver _k_: StepOut _l_: StepInto ^ + _bp_: Toogle Breakpoint _cb_: Conditional Breakpoint ^ + _c_: Run To Cursor _tt_: Go Debug Test + _sp_: Stop Debbuging + ^^ _<Esc>_ +]] +hydra({ + name = "dap", + hint = hint, + mode = "n", + config = { + color = "amaranth", + invoke_on_body = true, + hint = { + border = "rounded", + position = "bottom", + }, + }, + body = "<leader>d", + heads = { + { "d", dap.continue }, + { "bp", dap.toggle_breakpoint }, + { "l", dap.step_into }, + { "j", dap.step_over }, + { "k", dap.step_out }, + { "c", dap.run_to_cursor }, + { "tt", dap_go.debug_test }, + { + "cb", + function() + vim.ui.input({ prompt = "Condition: " }, function(condition) + dap.toggle_breakpoint(condition) + end) + end, + }, - for _, bind in pairs(bindings) do - vim.keymap.del(bind.mode, bind.lhs) - end -end, { noremap = true }) + { + "sp", + function() + dap.terminate() + dapui.close({}) + dap.clear_breakpoints() + end, + }, --- can be skipped since I can do it running the continue and promt to use the "Debug test" -vim.keymap.set("n", "<leader>dtt", dap_go.debug_test, { noremap = true }) + { "<Esc>", nil, { exit = true } }, + }, +}) diff --git a/lua/alpha/plugins.lua b/lua/alpha/plugins.lua index cc17db0..a332ff8 100644 --- a/lua/alpha/plugins.lua +++ b/lua/alpha/plugins.lua @@ -149,6 +149,7 @@ return require("packer").startup(function(use) "nvim-treesitter/nvim-treesitter", "antoinemadec/FixCursorHold.nvim", "nvim-neotest/neotest-go", + "nvim-neotest/neotest-plenary", "nvim-neotest/neotest-vim-test", }, }) diff --git a/plugin/keymaps.vim b/plugin/keymaps.vim index 89ab66f..d289e68 100644 --- a/plugin/keymaps.vim +++ b/plugin/keymaps.vim @@ -41,7 +41,7 @@ nnoremap <leader>o :lprev<CR> nnoremap <leader>bd :bd!<CR> -nnoremap <expr> <leader>dp ":saveas " . expand('%') +nnoremap <expr> <leader><leader>dp ":saveas " . expand('%') " For moving quickly up and down, " Goes to the first line above/below that isn't whitespace diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 1c1f179..092dab3 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -195,6 +195,11 @@ _G.packer_plugins = { path = "/home/alpha/.local/share/nvim/site/pack/packer/start/neotest-go", url = "https://github.com/nvim-neotest/neotest-go" }, + ["neotest-plenary"] = { + loaded = true, + path = "/home/alpha/.local/share/nvim/site/pack/packer/start/neotest-plenary", + url = "https://github.com/nvim-neotest/neotest-plenary" + }, ["neotest-vim-test"] = { loaded = true, path = "/home/alpha/.local/share/nvim/site/pack/packer/start/neotest-vim-test", @@ -468,6 +473,10 @@ _G.packer_plugins = { } time([[Defining packer_plugins]], false) +-- Config for: nvim-colorizer.lua +time([[Config for nvim-colorizer.lua]], true) +try_loadstring("\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14colorizer\frequire\0", "config", "nvim-colorizer.lua") +time([[Config for nvim-colorizer.lua]], false) -- Config for: nvim-projectconfig time([[Config for nvim-projectconfig]], true) try_loadstring("\27LJ\2\n@\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\23nvim-projectconfig\frequire\0", "config", "nvim-projectconfig") @@ -476,10 +485,6 @@ time([[Config for nvim-projectconfig]], false) time([[Config for git-worktree.nvim]], true) try_loadstring("\27LJ\2\n>\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\17git-worktree\frequire\0", "config", "git-worktree.nvim") time([[Config for git-worktree.nvim]], false) --- Config for: nvim-colorizer.lua -time([[Config for nvim-colorizer.lua]], true) -try_loadstring("\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14colorizer\frequire\0", "config", "nvim-colorizer.lua") -time([[Config for nvim-colorizer.lua]], false) -- Command lazy-loads time([[Defining lazy-load commands]], true) diff --git a/plugin/test.lua b/plugin/test.lua new file mode 100644 index 0000000..e48f658 --- /dev/null +++ b/plugin/test.lua @@ -0,0 +1,40 @@ +local hydra = require("hydra") + +vim.g["test#preserve_screen"] = 1 + +vim.cmd([[ + let test#php#pest#executable = 'sail test' + let test#strategy = 'neovim' + let test#neovim#term_position = 'vert' + let g:test#preserve_screen = 1 +]]) + +local hint = [[ + Vim Tests + _n_: Near test _f_: Current file _s_: Test Suit ^ + _l_: Test Last _g_: Visit + ^ ^ _<Esc>_ ^ +]] + +hydra({ + name = "vimtest", + hint = hint, + mode = "n", + config = { + color = "teal", + invoke_on_body = true, + hint = { + border = "rounded", + position = "bottom", + } + }, + body = "<leader>t", + heads = { + { "n", ":TestNearest<CR>" }, + { "f", ":TestFile<CR>" }, + { "s", ":TestSuit<CR>" }, + { "l", ":TestLast<CR>" }, + { "g", ":TestVisit<CR>" }, + { '<Esc>', nil, { exit = true } } + } +}) diff --git a/plugin/test.vim b/plugin/test.vim deleted file mode 100644 index ebcf9b5..0000000 --- a/plugin/test.vim +++ /dev/null @@ -1,9 +0,0 @@ -nmap <silent> t<C-n> :TestNearest<CR> -nmap <silent> t<C-f> :TestFile<CR> -nmap <silent> t<C-s> :TestSuite<CR> -nmap <silent> t<C-l> :TestLast<CR> -nmap <silent> t<C-g> :TestVisit<CR> - -let test#php#pest#executable = 'sail test' -let test#strategy = 'neovim' -let g:test#preserve_screen = 1 |