Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
63 changes: 63 additions & 0 deletions lua/notebook-navigator/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,60 @@ 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 },
},
{
config.hydra_keys.yank_cell,
function()
local success, miniai = pcall(require, "mini.ai")
if success then
miniai.select_textobject("a", M.config.cell_textobject_key)
vim.cmd "normal! y"
else
vim.notify "mini.ai required to yank cell"
end
end,
{ desc = "Delete cell", nowait = true },
},
{
config.hydra_keys.delete_cell,
function()
local success, miniai = pcall(require, "mini.ai")
if success then
miniai.select_textobject("a", M.config.cell_textobject_key)
vim.cmd "normal! d"
else
vim.notify "mini.ai required to delete cell"
end
end,
{ desc = "Delete cell", nowait = true },
},
{ "q", nil, { exit = true, nowait = true, desc = "exit" } },
{ "<esc>", nil, { exit = true, nowait = true, desc = "exit" } },
}
Expand Down Expand Up @@ -263,6 +317,12 @@ M.config = {
add_cell_before = "a",
add_cell_after = "b",
split_cell = "s",
delete_cell = "d",
yank_cell = "y",
merge_down = "m",
merge_up = "nil",
swap_up = "nil",
swap_down = "nil",
},
-- The repl plugin with which to interface
-- Current options: "iron" for iron.nvim, "toggleterm" for toggleterm.nvim,
Expand All @@ -273,6 +333,9 @@ M.config = {
syntax_highlight = false,
-- (Optional) for use with `mini.hipatterns` to highlight cell markers
cell_highlight_group = "Folded",
-- (Optional) for use with `mini.ai: key passed to mini as cell textobject.
-- for example: custom_textobjects = { h = nn.miniai_spec }
cell_textobject_key = "h",
}
--minidoc_afterlines_end

Expand Down