|
32 | 32 | module.load = function()
|
33 | 33 | links = module.required["core.links"]
|
34 | 34 | dirman_utils = module.required["core.dirman.utils"]
|
35 |
| - modules.await("core.keybinds", function(keybinds) |
36 |
| - keybinds.register_keybind(module.name, "hop-link") |
37 |
| - end) |
| 35 | + vim.keymap.set("", "<Plug>(neorg.esupports.hop.hop-link)", module.public.hop_link) |
| 36 | + vim.keymap.set("", "<Plug>(neorg.esupports.hop.hop-link.vsplit)", lib.wrap(module.public.hop_link, "vsplit")) |
38 | 37 | end
|
39 | 38 |
|
40 | 39 | module.config.public = {
|
@@ -677,6 +676,19 @@ module.public = {
|
677 | 676 | end,
|
678 | 677 | } --[[@as table<string, fun(): LinkTarget?>]])
|
679 | 678 | end,
|
| 679 | + |
| 680 | + hop_link = function(split_mode) |
| 681 | + local link_node_at_cursor = module.public.extract_link_node() |
| 682 | + |
| 683 | + if not link_node_at_cursor then |
| 684 | + log.trace("No link under cursor.") |
| 685 | + return |
| 686 | + end |
| 687 | + |
| 688 | + local parsed_link = module.public.parse_link(link_node_at_cursor) |
| 689 | + |
| 690 | + module.public.follow_link(link_node_at_cursor, split_mode, parsed_link) |
| 691 | + end |
680 | 692 | }
|
681 | 693 |
|
682 | 694 | module.private = {
|
@@ -946,23 +958,6 @@ module.private = {
|
946 | 958 | end,
|
947 | 959 | }
|
948 | 960 |
|
949 |
| -module.on_event = function(event) |
950 |
| - if event.split_type[2] == "core.esupports.hop.hop-link" then |
951 |
| - local split_mode = event.content[1] |
952 |
| - |
953 |
| - local link_node_at_cursor = module.public.extract_link_node() |
954 |
| - |
955 |
| - if not link_node_at_cursor then |
956 |
| - log.trace("No link under cursor.") |
957 |
| - return |
958 |
| - end |
959 |
| - |
960 |
| - local parsed_link = module.public.parse_link(link_node_at_cursor) |
961 |
| - |
962 |
| - module.public.follow_link(link_node_at_cursor, split_mode, parsed_link) |
963 |
| - end |
964 |
| -end |
965 |
| - |
966 | 961 | module.events.subscribed = {
|
967 | 962 | ["core.keybinds"] = {
|
968 | 963 | ["core.esupports.hop.hop-link"] = true,
|
|
0 commit comments