From 4ff933aeba4dd699173df226107b9ad1df660d2b Mon Sep 17 00:00:00 2001 From: Alejandro Rodriguez Date: Mon, 25 Nov 2024 14:09:34 +0100 Subject: [PATCH 1/4] added hydra heads for merging and swapping cells --- lua/notebook-navigator/init.lua | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lua/notebook-navigator/init.lua b/lua/notebook-navigator/init.lua index 797d291..c9c3dcb 100644 --- a/lua/notebook-navigator/init.lua +++ b/lua/notebook-navigator/init.lua @@ -207,6 +207,34 @@ local function activate_hydra(config) M.split_cell, { desc = "Split cell", nowait = true }, }, + { + config.hydra_keys.swap_up, + function() + M.swap_cell "u" + end, + { desc = "Swap with cell above", nowait = true }, + }, + { + config.hydra_keys.swap_down, + function() + M.swap_cell "d" + end, + { desc = "Swap with cell below", nowait = true }, + }, + { + config.hydra_keys.merge_up, + function() + M.merge_cell "u" + end, + { desc = "Merge with cell above", nowait = true }, + }, + { + config.hydra_keys.merge_down, + function() + M.merge_cell "d" + end, + { desc = "Merge with cell below", nowait = true }, + }, { "q", nil, { exit = true, nowait = true, desc = "exit" } }, { "", nil, { exit = true, nowait = true, desc = "exit" } }, } @@ -263,6 +291,10 @@ M.config = { add_cell_before = "a", add_cell_after = "b", split_cell = "s", + swap_up = "nil", + swap_down = "nil", + merge_up = "nil", + merge_down = "nil", }, -- The repl plugin with which to interface -- Current options: "iron" for iron.nvim, "toggleterm" for toggleterm.nvim, From 0c234ce75ed3295fce70a45a827c8710d122da2f Mon Sep 17 00:00:00 2001 From: Alejandro Rodriguez Date: Mon, 25 Nov 2024 14:11:19 +0100 Subject: [PATCH 2/4] docs for new hydra heads --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 4d43af8..53bc737 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,12 @@ Any options that are not specified when calling `setup` will take on their defau move_down = "j", add_cell_before = "a", add_cell_after = "b", + split = "s", + swap_up = "nil", + swap_down = "nil", + merge_up = "nil", + merge_down = "nil", + }, -- The repl plugin with which to interface -- Current options: "iron" for iron.nvim, "toggleterm" for toggleterm.nvim, From 135713ec4af28b5fc2536f353d8117ded603a335 Mon Sep 17 00:00:00 2001 From: Thomas Vandal Date: Tue, 23 Dec 2025 17:10:27 -0500 Subject: [PATCH 3/4] Add default keys and hints for swap and merge --- README.md | 8 ++++---- lua/notebook-navigator/init.lua | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 53bc737..a8fd666 100644 --- a/README.md +++ b/README.md @@ -151,10 +151,10 @@ Any options that are not specified when calling `setup` will take on their defau add_cell_before = "a", add_cell_after = "b", split = "s", - swap_up = "nil", - swap_down = "nil", - merge_up = "nil", - merge_down = "nil", + swap_up = "K", + swap_down = "J", + merge_up = "m", + merge_down = "M", }, -- The repl plugin with which to interface diff --git a/lua/notebook-navigator/init.lua b/lua/notebook-navigator/init.lua index c9c3dcb..c857c1f 100644 --- a/lua/notebook-navigator/init.lua +++ b/lua/notebook-navigator/init.lua @@ -155,6 +155,7 @@ end local hydra_hint = [[ _j_/_k_: move down/up _c_: comment _a_/_b_: add cell above/below _x_: run & move down _s_: split cell _X_: run + _J_/_K_: swap down/up _m_/_M_: merge with cell above/below __/_q_: exit ]] @@ -291,10 +292,10 @@ M.config = { add_cell_before = "a", add_cell_after = "b", split_cell = "s", - swap_up = "nil", - swap_down = "nil", - merge_up = "nil", - merge_down = "nil", + swap_up = "K", + swap_down = "J", + merge_up = "m", + merge_down = "M", }, -- The repl plugin with which to interface -- Current options: "iron" for iron.nvim, "toggleterm" for toggleterm.nvim, From a0f61178cacaaea117e68ff6c5eea562e5af02d7 Mon Sep 17 00:00:00 2001 From: Thomas Vandal Date: Tue, 23 Dec 2025 17:10:34 -0500 Subject: [PATCH 4/4] Rename split_cell in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a8fd666..327b399 100644 --- a/README.md +++ b/README.md @@ -150,7 +150,7 @@ Any options that are not specified when calling `setup` will take on their defau move_down = "j", add_cell_before = "a", add_cell_after = "b", - split = "s", + split_cell = "s", swap_up = "K", swap_down = "J", merge_up = "m",