Skip to content

Commit

Permalink
feat: add traverse-link Neorg mode (#1170)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaw4m4n authored Nov 18, 2023
1 parent 5a88bcb commit ed25267
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions lua/neorg/modules/core/integrations/treesitter/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ 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")
modules.await("core.keybinds", function(keybinds)
keybinds.register_keybinds(module.name, { "next.heading", "previous.heading", "next.link", "previous.link" })
end)
Expand Down
18 changes: 18 additions & 0 deletions lua/neorg/modules/core/keybinds/keybinds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,24 @@ module.config.public = {
noremap = true,
})

-- Map the below keys only when traverse-link mode is active
keybinds.map_event_to_mode("traverse-link", {
n = {
-- Move to the next link in the document
{ "j", "core.integrations.treesitter.next.link", opts = { desc = "Move to Next Link" } },

-- Move to the previous link in the document
{
"k",
"core.integrations.treesitter.previous.link",
opts = { desc = "Move to Previous Link" },
},
},
}, {
silent = true,
noremap = true,
})

-- Map the below keys on presenter mode
keybinds.map_event_to_mode("presenter", {
n = {
Expand Down

0 comments on commit ed25267

Please sign in to comment.