Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add traverse-link Neorg mode #1170

Merged
merged 1 commit into from
Nov 18, 2023
Merged
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
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