Skip to content

Commit

Permalink
feat: readd traverse-link and traverse-heading modes
Browse files Browse the repository at this point in the history
  • Loading branch information
vhyrro committed Jul 10, 2024
1 parent 283d6e3 commit 86c977b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lua/neorg/modules/core/integrations/treesitter/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ module.load = function()

module.private.ts_utils = ts_utils

module.required["core.mode"].add_mode("traverse-heading")
module.required["core.mode"].add_mode("traverse-link")
vim.keymap.set("", "<Plug>(neorg.treesitter.next.heading)", lib.wrap(module.public.goto_next_query_match, module.private.heading_query))
vim.keymap.set("", "<Plug>(neorg.treesitter.next.link)", lib.wrap(module.public.goto_next_query_match, module.private.link_query))
vim.keymap.set("", "<Plug>(neorg.treesitter.previous.heading)", lib.wrap(module.public.goto_previous_query_match, module.private.heading_query))
vim.keymap.set("", "<Plug>(neorg.treesitter.previous.link)", lib.wrap(module.public.goto_previous_query_match, module.private.link_query))
module.required["core.mode"].add_mode("traverse-heading", { "norg" })
module.required["core.mode"].add_mode("traverse-link", { "norg" })
vim.keymap.set("n", "<Plug>(neorg.treesitter.next.heading)", lib.wrap(module.public.goto_next_query_match, module.private.heading_query))
vim.keymap.set("n", "<Plug>(neorg.treesitter.next.link)", lib.wrap(module.public.goto_next_query_match, module.private.link_query))
vim.keymap.set("n", "<Plug>(neorg.treesitter.previous.heading)", lib.wrap(module.public.goto_previous_query_match, module.private.heading_query))
vim.keymap.set("n", "<Plug>(neorg.treesitter.previous.link)", lib.wrap(module.public.goto_previous_query_match, module.private.link_query))
end

module.config.public = {
Expand Down
30 changes: 30 additions & 0 deletions lua/neorg/modules/core/keybinds/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,36 @@ module.private = {
},
},
},
["traverse-heading"] = {
n = {
-- Move to the next heading in the document
{
"j",
"<Plug>(neorg.treesitter.next.heading)",
opts = { desc = "[neorg] Move to Next Heading" },
},

-- Move to the previous heading in the document
{
"k",
"<Plug>(neorg.treesitter.previous.heading)",
opts = { desc = "[neorg] Move to Previous Heading" },
},
},
},
["traverse-link"] = {
n = {
-- Move to the next link in the document
{ "j", "<Plug>(neorg.treesitter.next.link)", opts = { desc = "[neorg] Move to Next Link" } },

-- Move to the previous link in the document
{
"k",
"<Plug>(neorg.treesitter.previous.link)",
opts = { desc = "[neorg] Move to Previous Link" },
},
},
},
norg = {
n = {
-- Marks the task under the cursor as "undone"
Expand Down

0 comments on commit 86c977b

Please sign in to comment.